FreeCalypso > hg > fc-magnetite
comparison src/g23m-fad/fad/fad.h @ 174:90eb61ecd093
src/g23m-fad: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 12 Oct 2016 05:40:46 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
173:bf64d785238a | 174:90eb61ecd093 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-F&D (8411) | |
4 | Modul : FAD | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : Definitions for the Protocol Stack Entity | |
18 | Fax Adaptation 3.45 | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 | |
23 #ifndef FAD_H | |
24 #define FAD_H | |
25 | |
26 #include "cl_ribu.h" | |
27 | |
28 /* | |
29 * Macros | |
30 */ | |
31 | |
32 #undef TRACE_FAD_DL_TCF | |
33 | |
34 #define TRACE_FAD_DL_STATUS | |
35 #define TRACE_FAD_UL_STATUS | |
36 | |
37 #ifndef _SIMULATION_ /* keeps testcases passing */ | |
38 #define BMI_TCF_WORKAROUND | |
39 #endif | |
40 | |
41 #ifndef NTRACE | |
42 | |
43 /* for trace purposes */ | |
44 | |
45 #define SERVICE_NAME_KER "KER" | |
46 #define SERVICE_NAME_RCV "RCV" | |
47 #define SERVICE_NAME_RCVSUB "RCVSUB" | |
48 #define SERVICE_NAME_SND "SND" | |
49 #define SERVICE_NAME_SNDSUB "SNDSUB" | |
50 | |
51 #endif | |
52 | |
53 #define KER ker. | |
54 #define RCV rcv. | |
55 #define RCVSUB rcv.sub. | |
56 #define SND snd. | |
57 #define SNDSUB snd.sub. | |
58 | |
59 #define SHARED_FAX_DATA_RAM | |
60 | |
61 /* | |
62 * instance management | |
63 */ | |
64 | |
65 #define GET_INSTANCE(p) &fad_data_base[0] | |
66 | |
67 /* | |
68 * Constants | |
69 */ | |
70 | |
71 /* | |
72 * global unchangeable constants | |
73 */ | |
74 #define SBM_MAX_PRIMS 10 /* max numbers of prims in SBM */ | |
75 #define FRAME_SIZE 8 /* num of data bytes in fad frame */ | |
76 #define MAX_NEW_FRAMES 9 /* number of 64 bit frames | |
77 which can be received | |
78 in one ra_data_ind primitive */ | |
79 | |
80 #define MAX_SDU_SIZE (MAX_NEW_FRAMES * FRAME_SIZE) | |
81 | |
82 /*==== TYPES ======================================================*/ | |
83 | |
84 /* | |
85 * Constants | |
86 */ | |
87 | |
88 /* | |
89 * Bitoffset for encoding/decoding | |
90 */ | |
91 #define ENCODE_OFFSET 0 | |
92 | |
93 /* | |
94 * Dynamic Configuration Numbers | |
95 */ | |
96 | |
97 /* | |
98 * States of the entity process KERNEL | |
99 */ | |
100 #define KER_NULL 0 | |
101 #define IDLE 1 | |
102 #define BCS_REC 2 | |
103 #define BCS_TRA 3 | |
104 #define MSG_REC_TCF 4 | |
105 #define MSG_REC 5 | |
106 #define MSG_TRA_TCF 6 | |
107 #define MSG_TRA 7 | |
108 | |
109 /* | |
110 * States of the entity process SND | |
111 */ | |
112 #define SYNC_SND 0 | |
113 #define PREAM_SND 1 | |
114 #define TCF_SND 2 | |
115 #define TRAIN_SND 3 | |
116 #define TRAIN_CNF_SND 4 | |
117 #define BCS_SND 5 | |
118 #define MSG_SND 6 | |
119 | |
120 /* | |
121 * States of the entity process RCV | |
122 */ | |
123 #define SYNC_RCV 0 | |
124 #define PREAM_RCV 1 | |
125 #define TCF_RCV 2 | |
126 #define TRAIN_RCV 3 | |
127 #define BCS_RCV 4 | |
128 #define MSG_RCV 5 | |
129 | |
130 /* substates */ | |
131 #define SUB_IDLE 0 | |
132 #define SUB_PREAMBLE 1 | |
133 #define SUB_TCF 2 | |
134 #define SUB_POST_TCF 3 | |
135 #define SUB_DATA 4 | |
136 | |
137 /* | |
138 * FAD Constants | |
139 */ | |
140 | |
141 /* shared */ | |
142 | |
143 /* phase identifiers */ | |
144 #define IDENT_BCS_REC 0x11 | |
145 #define IDENT_MSG_REC 0x33 | |
146 #define IDENT_MSG_TRA 0x44 | |
147 | |
148 /* Layer 1 TI frame */ | |
149 #define L1_TI_LEN 40 | |
150 | |
151 /* RCV specific */ | |
152 | |
153 #ifdef _TARGET_ | |
154 #define FAD_DESCBUF_LEN 8 | |
155 #endif | |
156 | |
157 #define BCS_TOLERANCE 70 /* 70% tolerance for correct BCS data */ | |
158 #define TRAIN_TOLERANCE 50 | |
159 | |
160 /* SND specific */ | |
161 | |
162 /* Frame formats */ | |
163 | |
164 #define FR_SEQ_SYNC "\x3E\x37\x50\x96\xC1\xC8\xAF\x69" | |
165 #define FR_SEQ_PREAMBLE "\x11\x7E" /* BCS-REC + preamble */ | |
166 #define FR_SEQ_TRAIN_SND "\x33\x0F" /* MSG-REC + STATUS */ | |
167 #define FR_SEQ_TRAIN_RCV "\x44\x0F" /* MSG-TRA + STATUS */ | |
168 #define FR_SEQ_TCF "\x00\x00\x00\x00\x00\x00\x00\x00" | |
169 | |
170 #define VAL_TCF 0x00 | |
171 #define HDLC_FLAG 0x7E | |
172 #define VAL_TRAIN 0x0F | |
173 | |
174 /* length in bytes */ | |
175 #define LEN_SEQ_SYNC FRAME_SIZE | |
176 #define LEN_SEQ_PREAMBLE 2 | |
177 #define LEN_SEQ_TCF FRAME_SIZE | |
178 #define LEN_SEQ_TRAIN 2 | |
179 | |
180 #define SYNC_CYCLE_NONE 0 | |
181 #define SYNC_CYCLE_7200 4 | |
182 #define SYNC_CYCLE_12000 6 | |
183 | |
184 #define SYNC_RESET 3 | |
185 | |
186 #define REPEAT_FOREVER 0xFFFF /* bytes remaining - SYNC */ | |
187 | |
188 #define PREAMBLE_BYTES_TI_EXP 30 /* = 400 ms (give some extra tolerance to required 850 ms) */ | |
189 #define PREAMBLE_BYTES_TI_SND 74 /* = 1 sec */ | |
190 | |
191 #define TIME_AWAIT_TCF 75 /* 75 millisec. */ | |
192 #define TIME_TCF_SND 1500 /* 1500 millisec. */ | |
193 #define TIME_TCF_RCV 1350 /* 1500 millisec. - 10% */ | |
194 | |
195 #ifdef _SIMULATION_ | |
196 #define TIME_THRESHOLD 5000 /* 5-sec. MSG buffer - T.32, §7.4 */ | |
197 #else | |
198 #define TIME_THRESHOLD_TI 1000 | |
199 #endif | |
200 | |
201 #define MAX_SND_FRAMES 3 | |
202 #define SND_FRAME_LEN FRAME_SIZE /* 11.01.99/DL: 24 -> 8 */ | |
203 #define RCV_FRAME_LEN 24 | |
204 #define HDLC_LEN (RCV_FRAME_LEN * 12) | |
205 #define BCS_BUF_LEN (SND_FRAME_LEN * MAX_SND_FRAMES * 16) /* 336 */ | |
206 | |
207 #ifdef _SIMULATION_ | |
208 #define BCS_RATE 300 | |
209 #define HDLC_REPEAT 8 | |
210 #endif | |
211 | |
212 /* frame types - FAD internal */ | |
213 #define FT_PREAMBLE 0x06 | |
214 #define FT_TRAIN_RESPONSE 0x07 | |
215 #define FT_NONE 0x0F | |
216 | |
217 /*==== TYPES ======================================================*/ | |
218 | |
219 /* | |
220 * entity global data | |
221 */ | |
222 | |
223 /* | |
224 * send buffer management | |
225 */ | |
226 #define SBM_PRIMBUF_SIZE (SBM_MAX_PRIMS+1) | |
227 | |
228 typedef T_FAD_DATA_REQ T_SBM_PRIM; | |
229 typedef UBYTE T_SBM_PRIM_INDEX; | |
230 | |
231 typedef struct | |
232 { | |
233 T_SBM_PRIM *Prim; | |
234 } T_SBM_PRIMSLOT; | |
235 | |
236 /* | |
237 * receive buffer management | |
238 */ | |
239 #define RBM_PQ_MAX_PRIM 10 | |
240 #define RBM_PQ_SIZE (RBM_PQ_MAX_PRIM+1) | |
241 | |
242 typedef T_FAD_DATA_IND T_RBM_PRIM; | |
243 | |
244 /* | |
245 * data for send buffer management | |
246 */ | |
247 | |
248 typedef struct | |
249 { | |
250 USHORT syncCycle; | |
251 USHORT framesUntilSync; | |
252 USHORT CurrPrimOff; | |
253 USHORT CurrPrimLen; | |
254 USHORT FrameSize; | |
255 UBYTE frames[MAX_SDU_SIZE]; | |
256 T_RIBU ribu; | |
257 T_SBM_PRIMSLOT Prim[SBM_PRIMBUF_SIZE]; | |
258 T_SBM_PRIM_INDEX PA; | |
259 } T_SBM; | |
260 | |
261 /* | |
262 * data for receive buffer management | |
263 */ | |
264 | |
265 #define DL_RIBU_DEPTH 4 | |
266 | |
267 typedef struct | |
268 { | |
269 BOOL Initialised; | |
270 USHORT FramesPerPrim; | |
271 USHORT FramesInCurrPrim; | |
272 T_RIBU_FD *ribu; | |
273 T_RBM_PRIM *CurrPrim; | |
274 T_RIBU PQ; | |
275 T_RBM_PRIM *PQ_Array[RBM_PQ_SIZE]; | |
276 } T_RBM_FAD; | |
277 | |
278 typedef struct | |
279 { | |
280 UBYTE state; | |
281 #ifndef NTRACE | |
282 char *name; | |
283 char *state_name; | |
284 #endif | |
285 BOOL forward_data; | |
286 } T_KER; | |
287 | |
288 typedef struct | |
289 { | |
290 UBYTE state; | |
291 #ifndef NTRACE | |
292 char *name; | |
293 char *state_name; | |
294 #endif | |
295 } T_STATE; | |
296 | |
297 typedef struct | |
298 { | |
299 UBYTE state; | |
300 #ifndef NTRACE | |
301 char *name; | |
302 char *state_name; | |
303 #endif | |
304 T_STATE sub; /* substate */ | |
305 | |
306 UBYTE reset; | |
307 BOOL send_status; | |
308 BOOL send_ready_to_t30; | |
309 BOOL final; | |
310 UBYTE seq_buf [BCS_BUF_LEN]; | |
311 UBYTE ul_FD_align[L1_TI_LEN]; | |
312 | |
313 USHORT ra_req_frames; | |
314 USHORT seq_buflen; | |
315 USHORT seq_bufpos; | |
316 USHORT bytes_to_send; | |
317 USHORT threshold; /* T.32: 5-sec. buffer */ | |
318 USHORT data_to_send; | |
319 USHORT data_bufpos; | |
320 USHORT frames_per_prim; | |
321 USHORT trans_rate; | |
322 | |
323 T_FD FD; | |
324 U8 FD_buf[BCS_BUF_LEN]; | |
325 | |
326 T_FAD_DATA_REQ *fad_data_req; | |
327 #ifdef _TARGET_ | |
328 T_RA_DATA_REQ ra_data_req; | |
329 #endif | |
330 } T_SND; | |
331 | |
332 #define FLAGFOUND_MIN 5 | |
333 | |
334 typedef struct | |
335 { | |
336 UBYTE state; | |
337 #ifndef NTRACE | |
338 char *name; | |
339 char *state_name; | |
340 #endif | |
341 T_STATE sub; /* substate */ | |
342 | |
343 BOOL train_flg; | |
344 BOOL prim_ready; | |
345 BOOL data_incoming; | |
346 BOOL t30_req_frames; | |
347 BOOL data_in_rbm; | |
348 BOOL preamble_pending; | |
349 BOOL bcs_pending; | |
350 UBYTE bcs_data_len; | |
351 UBYTE hdlc [HDLC_LEN]; | |
352 | |
353 UBYTE FlagFound; /* HDLC flag in preamble found */ | |
354 UBYTE AlignShift; /* shift of HDLC flag in received RA_DATA_IND */ | |
355 USHORT AlignWord; | |
356 | |
357 USHORT bytes_good; | |
358 USHORT bytes_expect; | |
359 USHORT bytes_rcvd; | |
360 USHORT hdlc_len; | |
361 USHORT data_bufpos; | |
362 } T_RCV; | |
363 | |
364 typedef struct | |
365 { | |
366 T_KER ker; | |
367 T_SND snd; | |
368 T_RCV rcv; | |
369 T_SBM sbm; | |
370 T_RBM_FAD rbm; | |
371 } T_FAD_DATA; | |
372 | |
373 /* | |
374 * SBM, RBM: constants, type defs | |
375 */ | |
376 #define ENTITY_DATA fad_data | |
377 | |
378 /*==== EXPORT =====================================================*/ | |
379 /* | |
380 * instance data base | |
381 */ | |
382 | |
383 #ifdef FAD_PEI_C | |
384 GLOBAL T_FAD_DATA *fad_data; | |
385 #else | |
386 EXTERN T_FAD_DATA *fad_data; | |
387 #endif | |
388 | |
389 #ifdef SHARED_FAX_DATA_RAM | |
390 | |
391 /*lint -e526 : not defined */ | |
392 EXTERN UBYTE l2r_data_base[]; | |
393 EXTERN ULONG l2r_data_magic_num; | |
394 | |
395 #define fad_data_base ((T_FAD_DATA*)l2r_data_base) | |
396 | |
397 #define fad_data_magic_num l2r_data_magic_num | |
398 | |
399 #else /* !SHARED_FAX_DATA_RAM */ | |
400 | |
401 #ifdef FAD_PEI_C | |
402 GLOBAL T_FAD_DATA fad_data_base[1]; | |
403 GLOBAL ULONG fad_data_magic_num; | |
404 #else | |
405 EXTERN T_FAD_DATA fad_data_base[]; | |
406 EXTERN ULONG fad_data_magic_num; | |
407 #endif | |
408 | |
409 #endif /* !SHARED_FAX_DATA_RAM */ | |
410 | |
411 #define FAD_DATA_MAGIC_NUM (('F'<<24) + ('A'<<16) + ('D'<<8)) /* "FAD",NUL */ | |
412 | |
413 /* | |
414 * Prototypes | |
415 * | |
416 * FAD KERNEL | |
417 * | |
418 * KERNEL primitive processing | |
419 */ | |
420 | |
421 #ifdef USE_L1FD_FUNC_INTERFACE | |
422 EXTERN void l1i_ra_detect_req(T_RA_DETECT_REQ *ra_detect_req); | |
423 #endif | |
424 | |
425 #ifdef OPTION_MULTITHREAD | |
426 #define ker_fad_activate_req _ENTITY_PREFIXED(ker_fad_activate_req) | |
427 #define ker_fad_deactivate_req _ENTITY_PREFIXED(ker_fad_deactivate_req) | |
428 #define ker_fad_modify_req _ENTITY_PREFIXED(ker_fad_modify_req) | |
429 #define ker_fad_data_req _ENTITY_PREFIXED(ker_fad_data_req) | |
430 #define ker_fad_snd_tcf_req _ENTITY_PREFIXED(ker_fad_snd_tcf_req) | |
431 #define ker_fad_rcv_tcf_req _ENTITY_PREFIXED(ker_fad_rcv_tcf_req) | |
432 #define ker_fad_ready_req _ENTITY_PREFIXED(ker_fad_ready_req) | |
433 #define ker_fad_ignore_req _ENTITY_PREFIXED(ker_fad_ignore_req) | |
434 #endif | |
435 | |
436 EXTERN void ker_fad_activate_req (T_FAD_ACTIVATE_REQ *fad_activate_req); | |
437 EXTERN void ker_fad_deactivate_req (T_FAD_DEACTIVATE_REQ *fad_deactivate_req); | |
438 EXTERN void ker_fad_modify_req (T_FAD_MODIFY_REQ *fad_modify_req); | |
439 EXTERN void ker_fad_data_req (T_FAD_DATA_REQ *fad_data_req); | |
440 EXTERN void ker_fad_snd_tcf_req (T_FAD_SND_TCF_REQ *fad_snd_tcf_req); | |
441 EXTERN void ker_fad_rcv_tcf_req (T_FAD_RCV_TCF_REQ *fad_rcv_tcf_req); | |
442 EXTERN void ker_fad_ready_req (T_FAD_READY_REQ *fad_ready_req); | |
443 EXTERN void ker_fad_ignore_req (T_FAD_IGNORE_REQ *fad_ignore_req); | |
444 | |
445 /* | |
446 * KERNEL signal processing | |
447 */ | |
448 | |
449 /* | |
450 * KERNEL procedures | |
451 */ | |
452 | |
453 #ifdef OPTION_MULTITHREAD | |
454 #define ker_init _ENTITY_PREFIXED(ker_init) | |
455 #define ker_SetError _ENTITY_PREFIXED(ker_SetError) | |
456 #endif | |
457 | |
458 EXTERN void ker_init (void); | |
459 EXTERN void ker_SetError (USHORT cause); | |
460 | |
461 /* | |
462 * FAD RCV | |
463 * | |
464 * RCV primitive processing | |
465 */ | |
466 | |
467 #ifdef OPTION_MULTITHREAD | |
468 #define rcv_ra_data_ind _ENTITY_PREFIXED(rcv_ra_data_ind) | |
469 | |
470 #endif | |
471 | |
472 EXTERN void rcv_ra_data_ind (T_RA_DATA_IND *ra_data_ind); | |
473 | |
474 /* | |
475 * RCV signal processing | |
476 */ | |
477 #ifdef OPTION_MULTITHREAD | |
478 /* KER -> RCV */ | |
479 #define sig_ker_rcv_await_tcf_req _ENTITY_PREFIXED(sig_ker_rcv_await_tcf_req) | |
480 #define sig_ker_rcv_ready_req _ENTITY_PREFIXED(sig_ker_rcv_ready_req) | |
481 #define sig_ker_rcv_reset_req _ENTITY_PREFIXED(sig_ker_rcv_reset_req) | |
482 /* RCV -> KER */ | |
483 #define sig_rcv_ker_preamble_ind _ENTITY_PREFIXED(sig_rcv_ker_preamble_ind) | |
484 #define sig_rcv_ker_tcf_ind _ENTITY_PREFIXED(sig_rcv_ker_tcf_ind) | |
485 #define sig_rcv_ker_train_ind _ENTITY_PREFIXED(sig_rcv_ker_train_ind) | |
486 #define sig_rcv_ker_train_end_ind _ENTITY_PREFIXED(sig_rcv_ker_train_end_ind) | |
487 #define sig_rcv_ker_bcs_ind _ENTITY_PREFIXED(sig_rcv_ker_bcs_ind) | |
488 #define sig_rcv_ker_msg_ind _ENTITY_PREFIXED(sig_rcv_ker_msg_ind) | |
489 #define sig_rcv_ker_status_ind _ENTITY_PREFIXED(sig_rcv_ker_status_ind) | |
490 #define sig_rcv_ker_error_ind _ENTITY_PREFIXED(sig_rcv_ker_error_ind) | |
491 #endif | |
492 | |
493 EXTERN void sig_ker_rcv_await_tcf_req (void); | |
494 EXTERN void sig_ker_rcv_ready_req (void); | |
495 EXTERN void sig_ker_rcv_reset_req (void); | |
496 | |
497 EXTERN void sig_rcv_ker_preamble_ind (void); | |
498 EXTERN void sig_rcv_ker_tcf_ind (void); | |
499 EXTERN void sig_rcv_ker_train_ind (void); | |
500 EXTERN void sig_rcv_ker_train_end_ind (void); | |
501 EXTERN void sig_rcv_ker_bcs_ind (UBYTE *hdlc, USHORT hdlc_len); | |
502 EXTERN void sig_rcv_ker_msg_ind (T_FAD_DATA_IND *fad_data_ind); | |
503 EXTERN void sig_rcv_ker_status_ind (void); | |
504 EXTERN void sig_rcv_ker_error_ind (USHORT cause); | |
505 | |
506 /* | |
507 * RCV procedures | |
508 */ | |
509 | |
510 #ifdef OPTION_MULTITHREAD | |
511 #define rcv_init _ENTITY_PREFIXED(rcv_init) | |
512 #define rcv_ResetFormatter _ENTITY_PREFIXED(rcv_ResetFormatter) | |
513 #define rcv_FrameType _ENTITY_PREFIXED(rcv_FrameType) | |
514 #define rcv_SetHdlcFrame _ENTITY_PREFIXED(rcv_SetHdlcFrame) | |
515 #define rcv_SetErrorRatio _ENTITY_PREFIXED(rcv_SetErrorRatio) | |
516 #define rcv_GetMsgData _ENTITY_PREFIXED(rcv_GetMsgData) | |
517 #define rcv_SetFinalBuffer _ENTITY_PREFIXED(rcv_SetFinalBuffer) | |
518 #endif | |
519 | |
520 EXTERN void rcv_init (void); | |
521 EXTERN void rcv_ResetFormatter (void); | |
522 EXTERN UBYTE rcv_FrameType (T_FD *pFD); | |
523 EXTERN void rcv_SetHdlcFrame (T_FD *pFD, UBYTE *hdlc_data, USHORT *hdlc_len); | |
524 EXTERN void rcv_SetErrorRatio (T_FD *pFD); | |
525 | |
526 EXTERN BOOL rcv_StoreMsgData (T_FD *pFD, BOOL *primAvail); | |
527 | |
528 EXTERN BOOL rcv_GetMsgData (T_FAD_DATA_IND **fad_data_ind, BOOL data_incoming); | |
529 EXTERN void rcv_SetFinalBuffer (void); | |
530 | |
531 #ifdef _TARGET_ | |
532 EXTERN void l1i_ra_detect_req(T_RA_DETECT_REQ *ra_detect_req); | |
533 #endif | |
534 | |
535 /* | |
536 * FAD SND | |
537 * | |
538 * SND primitive processing | |
539 */ | |
540 | |
541 #ifdef OPTION_MULTITHREAD | |
542 #define snd_ra_ready_ind _ENTITY_PREFIXED(snd_ra_ready_ind) | |
543 #endif | |
544 | |
545 EXTERN void snd_ra_ready_ind (T_RA_READY_IND *ra_ready_ind); | |
546 | |
547 /* | |
548 * SND signal processing | |
549 */ | |
550 #ifdef OPTION_MULTITHREAD | |
551 /* KER -> SND */ | |
552 #define sig_ker_snd_activate_req _ENTITY_PREFIXED(sig_ker_snd_activate_req) | |
553 #define sig_ker_snd_sync_req _ENTITY_PREFIXED(sig_ker_snd_sync_req) | |
554 #define sig_ker_snd_train_req _ENTITY_PREFIXED(sig_ker_snd_train_req) | |
555 #define sig_ker_snd_tcf_req _ENTITY_PREFIXED(sig_ker_snd_tcf_req) | |
556 #define sig_ker_snd_preamble_req _ENTITY_PREFIXED(sig_ker_snd_preamble_req) | |
557 #define sig_ker_snd_bcs_req _ENTITY_PREFIXED(sig_ker_snd_bcs_req) | |
558 #define sig_ker_snd_status_req _ENTITY_PREFIXED(sig_ker_snd_status_req) | |
559 /* SND -> KER */ | |
560 #define sig_snd_ker_ready_ind _ENTITY_PREFIXED(sig_snd_ker_ready_ind) | |
561 #define sig_snd_ker_data_sent_ind _ENTITY_PREFIXED(sig_snd_ker_data_sent_ind) | |
562 #endif | |
563 | |
564 EXTERN void sig_ker_snd_activate_req (T_FAD_ACTIVATE_REQ *fad_activate_req); | |
565 EXTERN void sig_ker_snd_sync_req (BOOL reset); | |
566 EXTERN void sig_ker_snd_train_req (T_FAD_DATA_REQ *fad_data_req, | |
567 BOOL send_fax); | |
568 EXTERN void sig_ker_snd_tcf_req (void); | |
569 EXTERN void sig_ker_snd_preamble_req (T_FAD_DATA_REQ *fad_data_req); | |
570 EXTERN void sig_ker_snd_bcs_req (T_FAD_DATA_REQ *fad_data_req); | |
571 EXTERN void sig_ker_snd_status_req (void); | |
572 EXTERN void sig_ker_snd_msg_req (T_FAD_DATA_REQ *fad_data_req); | |
573 | |
574 EXTERN void sig_snd_ker_ready_ind (void); | |
575 EXTERN void sig_snd_ker_data_sent_ind (void); | |
576 | |
577 /* | |
578 * SND procedures | |
579 */ | |
580 | |
581 #ifdef OPTION_MULTITHREAD | |
582 #define snd_init _ENTITY_PREFIXED(snd_init) | |
583 #define snd_SendReset _ENTITY_PREFIXED(snd_SendReset) | |
584 #define snd_SetSequence _ENTITY_PREFIXED(snd_SetSequence) | |
585 #define snd_SendSequence _ENTITY_PREFIXED(snd_SendSequence) | |
586 #define snd_DurationToBytes _ENTITY_PREFIXED(snd_DurationToBytes) | |
587 #define snd_BuildStatusFrames _ENTITY_PREFIXED(snd_BuildStatusFrames) | |
588 #define snd_StoreMsgData _ENTITY_PREFIXED(snd_StoreMsgData) | |
589 #define snd_SendMsgData _ENTITY_PREFIXED(snd_SendMsgData) | |
590 #define snd_SendBcsData _ENTITY_PREFIXED(snd_SendBcsData) | |
591 #endif | |
592 | |
593 EXTERN void snd_init (void); | |
594 GLOBAL void snd_SendReset (USHORT bytes_to_send); | |
595 EXTERN void snd_SetSequence (UBYTE *seq_buf, USHORT *seq_buflen, | |
596 UBYTE *sequence, USHORT seq_len, | |
597 USHORT repeat); | |
598 EXTERN USHORT snd_SendSequence (USHORT bytes_to_send, UBYTE fr_type); | |
599 EXTERN USHORT snd_DurationToBytes (USHORT trans_rate, USHORT duration); | |
600 | |
601 #ifdef _SIMULATION_ | |
602 EXTERN void snd_BuildStatusFrames(T_FAD_DATA_REQ *fad_data_req, USHORT max_bytes); | |
603 #else | |
604 EXTERN void snd_BuildStatusFrames(T_FAD_DATA_REQ *fad_data_req); | |
605 #endif | |
606 | |
607 EXTERN void snd_StoreMsgData (T_FAD_DATA_REQ *fad_data_req); | |
608 EXTERN BOOL snd_SendMsgData (UBYTE req_frames); | |
609 | |
610 #ifdef _SIMULATION_ | |
611 EXTERN void snd_SendBcsData (USHORT bytes_to_send); | |
612 #else | |
613 EXTERN void snd_SendBcsData (void); | |
614 #endif | |
615 | |
616 /* SBM_RBM_BEGIN */ | |
617 /* | |
618 * Send Buffer Management SBM | |
619 */ | |
620 #ifdef OPTION_MULTITHREAD | |
621 #define sbm_init _ENTITY_PREFIXED(sbm_init) | |
622 #define sbm_store_prim _ENTITY_PREFIXED(sbm_store_prim) | |
623 #define sbm_get_frame _ENTITY_PREFIXED(sbm_get_frame) | |
624 #define sbm_free_empty_prims _ENTITY_PREFIXED(sbm_free_empty_prims) | |
625 #endif | |
626 | |
627 EXTERN void sbm_init (USHORT frameSize); | |
628 EXTERN void sbm_store_prim (T_SBM_PRIM *sendPrim); | |
629 EXTERN BOOL sbm_get_frame (T_FRAME_DESC *frameDesc, UBYTE reqFrames); | |
630 EXTERN void sbm_free_empty_prims (void); | |
631 | |
632 /* | |
633 * Receive Buffer Management RBM | |
634 */ | |
635 | |
636 #ifdef OPTION_MULTITHREAD | |
637 #define rbm_init _ENTITY_PREFIXED(rbm_init ) | |
638 #define rbm_deinit _ENTITY_PREFIXED(rbm_deinit ) | |
639 #define rbm_reset _ENTITY_PREFIXED(rbm_reset ) | |
640 #define rbm_store_frames _ENTITY_PREFIXED(rbm_store_frames ) | |
641 #define rbm_get_prim _ENTITY_PREFIXED(rbm_get_prim ) | |
642 #define rbm_get_curr_prim _ENTITY_PREFIXED(rbm_get_curr_prim ) | |
643 #endif | |
644 | |
645 EXTERN void rbm_init(USHORT framesPerPrim); | |
646 EXTERN void rbm_deinit(BOOL final); | |
647 EXTERN void rbm_reset(void); | |
648 | |
649 EXTERN BOOL rbm_store_frames(T_FD *pFDw, BOOL *primIsReady); | |
650 | |
651 EXTERN T_RBM_PRIM *rbm_get_prim(void); | |
652 EXTERN T_RBM_PRIM *rbm_get_curr_prim(void); | |
653 | |
654 /* | |
655 * Communication handles | |
656 */ | |
657 #ifdef OPTION_MULTITHREAD | |
658 #define hCommT30 _ENTITY_PREFIXED(hCommT30) | |
659 #ifdef _SIMULATION_ | |
660 #define hCommRA _ENTITY_PREFIXED(hCommRA) | |
661 #endif | |
662 #endif | |
663 | |
664 #ifdef FAD_PEI_C | |
665 | |
666 GLOBAL T_HANDLE fad_handle; /* own handle */ | |
667 GLOBAL T_HANDLE hCommT30 = VSI_ERROR; /* T30 Communication */ | |
668 #ifdef _SIMULATION_ | |
669 GLOBAL T_HANDLE hCommRA = VSI_ERROR; /* RA Communication */ | |
670 #endif | |
671 | |
672 #else | |
673 | |
674 EXTERN T_HANDLE fad_handle; /* own handle */ | |
675 EXTERN T_HANDLE hCommT30; /* T30 Communication */ | |
676 #ifdef _SIMULATION_ | |
677 EXTERN T_HANDLE hCommRA; /* RA Communication */ | |
678 #endif | |
679 | |
680 #endif | |
681 | |
682 GLOBAL void fad_exec_timeout(USHORT index); | |
683 | |
684 #define BYTE2HEXSTR(B, H) {UBYTE b, *a = (UBYTE*)(H);\ | |
685 b = (((UBYTE)(B)) >> 4) & 0x0F;\ | |
686 if (b > 9) b += 'A'-10; else b += '0'; *a = b;\ | |
687 b = ((UBYTE)(B)) & 0x0F;\ | |
688 if (b > 9) b += 'A'-10; else b += '0'; *(a+1) = b;} | |
689 | |
690 #endif |