FreeCalypso > hg > freecalypso-citrine
comparison g23m-aci/uart/uart_rxp.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : | |
4 | Modul : | |
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 : This modul is part of the entity UART and implements all | |
18 | functions to handles the incoming primitives as described in | |
19 | the SDL-documentation (RX-statemachine) | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 #ifndef UART_RXP_C | |
24 #define UART_RXP_C | |
25 #endif /* !UART_RXP_C */ | |
26 | |
27 #include "config.h" | |
28 #include "fixedconf.h" | |
29 #include "condat-features.h" | |
30 | |
31 #define ENTITY_UART | |
32 | |
33 #ifndef FF_MULTI_PORT | |
34 /*==== INCLUDES =============================================================*/ | |
35 | |
36 #ifdef WIN32 | |
37 #include "nucleus.h" | |
38 #endif /* WIN32 */ | |
39 #include "typedefs.h" /* to get Condat data types */ | |
40 #include "vsi.h" /* to get a lot of macros */ | |
41 #include "macdef.h" /* to get a lot of macros */ | |
42 #include "custom.h" | |
43 #include "gsm.h" /* to get a lot of macros */ | |
44 #include "cnf_uart.h" /* to get cnf-definitions */ | |
45 #include "mon_uart.h" /* to get mon-definitions */ | |
46 #include "prim.h" /* to get the definitions of used SAP and directions */ | |
47 #include "dti.h" /* to get dti lib */ | |
48 #include "pei.h" /* to get PEI interfac */ | |
49 #ifdef _TARGET_ | |
50 #include "../../serial/serialswitch.h" | |
51 #include "../../serial/traceswitch.h" | |
52 #else /* _TARGET_ */ | |
53 #include "serial_dat.h" /* to get definitions of serial driver */ | |
54 #endif /* _TARGET_ */ | |
55 #include "uart.h" /* to get the global entity definitions */ | |
56 | |
57 #include "uart_rxf.h" /* to get rx functions */ | |
58 | |
59 #include "uart_kers.h" /* to get ker signals */ | |
60 #include "uart_dtxs.h" /* to get dtx signals */ | |
61 | |
62 #ifdef _SIMULATION_ | |
63 #include <stdio.h> /* to get sprintf */ | |
64 #include "uart_rxp.h" /* to get rx_readdata */ | |
65 #endif /* _SIMULATION_ */ | |
66 /*==== CONST ================================================================*/ | |
67 | |
68 /*==== LOCAL VARS ===========================================================*/ | |
69 | |
70 /*==== PRIVATE FUNCTIONS ====================================================*/ | |
71 | |
72 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
73 | |
74 | |
75 | |
76 /* | |
77 +------------------------------------------------------------------------------ | |
78 | Function : rx_uart_driver_received_ind | |
79 +------------------------------------------------------------------------------ | |
80 | Description : Handles the primitive UART_DRIVER_RECEIVED_IND | |
81 | | |
82 | Parameters : *uart_device - affected device database | |
83 | | |
84 +------------------------------------------------------------------------------ | |
85 */ | |
86 GLOBAL void rx_uart_driver_received_ind ( T_UART_DATA* uart_device ) | |
87 { | |
88 USHORT i; | |
89 BOOL continuous; | |
90 T_DLC* dlc; | |
91 T_desc2* temp_desc = NULL; | |
92 ULONG line_states; | |
93 | |
94 TRACE_EVENT( "rx_uart_driver_received_ind()" ); | |
95 | |
96 /* | |
97 * set affected instance | |
98 */ | |
99 uart_data = uart_device; | |
100 | |
101 /* | |
102 * inform about new line states | |
103 */ | |
104 if(uart_data->rx.lines NEQ uart_data->rx.prev_lines) | |
105 { | |
106 /* | |
107 * convert line states and send it | |
108 */ | |
109 line_states = 0; | |
110 if(uart_data->rx.lines & X_MASK) | |
111 { | |
112 line_states|= UART_X_RX_MASK; | |
113 if(!(uart_data->rx.prev_lines & X_MASK)) | |
114 { | |
115 TRACE_EVENT("RX Flow Control: stop"); | |
116 } | |
117 } | |
118 else if(uart_data->rx.prev_lines & X_MASK) | |
119 { | |
120 TRACE_EVENT("RX Flow Control: start"); | |
121 } | |
122 | |
123 if(uart_data->rx.lines & SA_MASK) | |
124 { | |
125 line_states|= UART_SA_RX_MASK; | |
126 if(!(uart_data->rx.prev_lines & SA_MASK)) | |
127 { | |
128 TRACE_EVENT("DTR: drop"); | |
129 } | |
130 } | |
131 else if(uart_data->rx.prev_lines & SA_MASK) | |
132 { | |
133 TRACE_EVENT("DTR: on"); | |
134 } | |
135 | |
136 if(uart_data->rx.lines & SB_MASK) | |
137 { | |
138 line_states|= UART_SB_RX_MASK; | |
139 if(!(uart_data->rx.prev_lines & SB_MASK)) | |
140 { | |
141 TRACE_EVENT("RTS: off"); | |
142 } | |
143 } | |
144 else if(uart_data->rx.prev_lines & SB_MASK) | |
145 { | |
146 TRACE_EVENT("RTS: on"); | |
147 } | |
148 | |
149 if(uart_data->rx.lines & ESC_MASK) | |
150 { | |
151 line_states|= UART_ESC_RX_MASK; | |
152 TRACE_EVENT("Escape Sequence detected"); | |
153 } | |
154 | |
155 if(uart_data->rx.lines & BRK_MASK) | |
156 { | |
157 line_states|= UART_BRK_RX_MASK; | |
158 line_states|= (((uart_data->rx.lines & BRK_LEN_MASK) | |
159 >> BRKLEN) << UART_BRKLEN_RX_POS); | |
160 TRACE_EVENT("Break detected"); | |
161 } | |
162 /* | |
163 * store new line states | |
164 */ | |
165 uart_data->rx.lines&= ~(ESC_MASK | | |
166 BRK_MASK | | |
167 BRK_LEN_MASK); | |
168 uart_data->rx.prev_lines = uart_data->rx.lines; | |
169 /* | |
170 * inform MMI | |
171 */ | |
172 sig_rx_ker_line_states_ind(line_states); | |
173 } | |
174 | |
175 switch( GET_STATE( UART_SERVICE_RX ) ) | |
176 { | |
177 case RX_READY: | |
178 dlc = &uart_data->dlc_table[UART_CONTROL_INSTANCE]; | |
179 if(uart_data->rx.dlc_instance NEQ UART_EMPTY_INSTANCE) | |
180 { | |
181 uart_data->rx.dlc_instance = UART_EMPTY_INSTANCE; | |
182 uart_data->rx.analyze_state = UART_RX_ERROR; | |
183 /* | |
184 * if ISR has read out some data | |
185 * inform all channels about data reception | |
186 */ | |
187 if(uart_data->rx.read_permission) | |
188 { | |
189 for(i = 0; i <= UART_MAX_NUMBER_OF_CHANNELS; i++) | |
190 { | |
191 switch(uart_data->dlc_table[i].receive_process) | |
192 { | |
193 case UART_RX_PROCESS_READY: | |
194 case UART_RX_PROCESS_COMPLETE: | |
195 /* | |
196 * inform all channels about data reception | |
197 */ | |
198 uart_data->dlc_table[i].receive_process = UART_RX_PROCESS_STOP; | |
199 temp_desc = uart_data->dlc_table[i].receive_data; | |
200 uart_data->dlc_table[i].receive_data = NULL; | |
201 if(i EQ UART_CONTROL_INSTANCE) | |
202 { | |
203 /* | |
204 * Control channel | |
205 */ | |
206 sig_rx_ker_data_received_ind( | |
207 temp_desc, | |
208 uart_data->dlc_table[i].receive_pos); | |
209 } | |
210 else | |
211 { | |
212 /* | |
213 * Data channel | |
214 */ | |
215 uart_data->dtx = uart_data->dlc_table[i].dtx; | |
216 sig_rx_dtx_data_received_ind( | |
217 temp_desc, | |
218 uart_data->dlc_table[i].receive_pos); | |
219 } | |
220 /* fall through */ | |
221 case UART_RX_PROCESS_STOP: | |
222 /* | |
223 * add new channels which want to receive | |
224 */ | |
225 if(uart_data->dlc_table[i].receive_data) | |
226 uart_data->dlc_table[i].receive_process = UART_RX_PROCESS_READY; | |
227 break; | |
228 | |
229 default: | |
230 TRACE_EVENT_P2("Unexpected DLC process state: %d | uart_rxp.c(%d)", | |
231 dlc->receive_process, __LINE__); | |
232 break; | |
233 } | |
234 } | |
235 } | |
236 } | |
237 else | |
238 { | |
239 switch(dlc->receive_process) | |
240 { | |
241 case UART_RX_PROCESS_READY: | |
242 case UART_RX_PROCESS_COMPLETE: | |
243 /* | |
244 * if ISR has read out some data | |
245 * inform channel about data reception | |
246 */ | |
247 if(uart_data->rx.read_permission) | |
248 { | |
249 /* | |
250 * inform channel about data reception | |
251 */ | |
252 dlc->receive_process = UART_RX_PROCESS_STOP; | |
253 temp_desc = dlc->receive_data; | |
254 dlc->receive_data = NULL; | |
255 uart_data->dtx = dlc->dtx; | |
256 sig_rx_dtx_data_received_ind(temp_desc, dlc->receive_pos); | |
257 } | |
258 /* fall through */ | |
259 case UART_RX_PROCESS_STOP: | |
260 /* | |
261 * add new channel which want to receive | |
262 */ | |
263 if(dlc->receive_data) | |
264 dlc->receive_process = UART_RX_PROCESS_READY; | |
265 break; | |
266 | |
267 default: | |
268 TRACE_EVENT_P2("Unexpected DLC process state: %d | uart_rxp.c(%d)", | |
269 dlc->receive_process, __LINE__); | |
270 break; | |
271 } | |
272 } | |
273 if(dlc->receive_process EQ UART_RX_PROCESS_STOP) | |
274 { | |
275 uart_data->rx.receive_state = UART_RX_NOT_RECEIVING; | |
276 break; | |
277 } | |
278 | |
279 #ifdef _SIMULATION_ | |
280 if(rx_inpavail(uart_data->device) > 0) | |
281 #else /* _SIMULATION_ */ | |
282 if(UF_InpAvail (uart_data->device) > 0) | |
283 #endif /* _SIMULATION_ */ | |
284 { | |
285 /* | |
286 * inform channel about reading | |
287 */ | |
288 uart_data->rx.read_permission = TRUE; | |
289 uart_data->dtx = dlc->dtx; | |
290 sig_rx_dtx_receiving_ind(); | |
291 } | |
292 else | |
293 uart_data->rx.read_permission = FALSE; | |
294 | |
295 if(uart_data EQ (&(uart_data_base[0]))) | |
296 { | |
297 TRACE_EVENT("UF_ReadData()"); | |
298 #ifdef _SIMULATION_ | |
299 rx_readdata(0); | |
300 #else /* _SIMULATION_ */ | |
301 UF_ReadData (uart_data->device, sm_suspend, rx_readOutFunc_0); | |
302 #endif /* else _SIMULATION_ */ | |
303 } | |
304 #ifdef FF_TWO_UART_PORTS | |
305 else if(uart_data EQ (&(uart_data_base[1]))) | |
306 { | |
307 TRACE_EVENT("UF_ReadData()"); | |
308 #ifdef _SIMULATION_ | |
309 rx_readdata(1); | |
310 #else /* _SIMULATION_ */ | |
311 UF_ReadData (uart_data->device, sm_suspend, rx_readOutFunc_1); | |
312 #endif /* else _SIMULATION_ */ | |
313 } | |
314 #endif /* FF_TWO_UART_PORTS */ | |
315 else | |
316 { | |
317 TRACE_ERROR("wrong value of uart_data"); | |
318 } | |
319 break; | |
320 | |
321 case RX_MUX: | |
322 if(uart_data->rx.dlc_instance EQ UART_EMPTY_INSTANCE) | |
323 { | |
324 uart_data->rx.dlc_instance = UART_CONTROL_INSTANCE; | |
325 uart_data->rx.analyze_state = UART_RX_ERROR; | |
326 } | |
327 continuous = FALSE; | |
328 for(i = 0; i <= UART_MAX_NUMBER_OF_CHANNELS; i++) | |
329 { | |
330 dlc = &uart_data->dlc_table[i]; | |
331 switch(dlc->receive_process) | |
332 { | |
333 case UART_RX_PROCESS_READY: | |
334 case UART_RX_PROCESS_COMPLETE: | |
335 /* | |
336 * if ISR has read out some data | |
337 * inform all channels about data reception | |
338 */ | |
339 if(uart_data->rx.read_permission) | |
340 { | |
341 dlc->receive_process = UART_RX_PROCESS_STOP; | |
342 temp_desc = dlc->receive_data; | |
343 dlc->receive_data = NULL; | |
344 if(i EQ UART_CONTROL_INSTANCE) | |
345 { | |
346 /* | |
347 * Control channel | |
348 */ | |
349 sig_rx_ker_data_received_ind(temp_desc, dlc->receive_pos); | |
350 } | |
351 else | |
352 { | |
353 /* | |
354 * Data channel | |
355 */ | |
356 uart_data->dtx = dlc->dtx; | |
357 sig_rx_dtx_data_received_ind(temp_desc, dlc->receive_pos); | |
358 } | |
359 } | |
360 /* fall through */ | |
361 case UART_RX_PROCESS_STOP: | |
362 /* | |
363 * add new channels which want to receive | |
364 */ | |
365 if(dlc->receive_data) | |
366 dlc->receive_process = UART_RX_PROCESS_READY; | |
367 break; | |
368 | |
369 default: | |
370 TRACE_EVENT_P2("Unexpected DLC process state: %d, uart_rxp.c(%d)", | |
371 dlc->receive_process, __LINE__); | |
372 break; | |
373 } | |
374 if(dlc->receive_process NEQ UART_RX_PROCESS_STOP) | |
375 continuous = TRUE; | |
376 } | |
377 /* | |
378 * check whether there is a channel to receive | |
379 */ | |
380 if(continuous NEQ TRUE) | |
381 { | |
382 uart_data->rx.receive_state = UART_RX_NOT_RECEIVING; | |
383 break; | |
384 } | |
385 #ifdef _SIMULATION_ | |
386 if(rx_inpavail(uart_data->device) > 0) | |
387 #else /* _SIMULATION_ */ | |
388 if(UF_InpAvail (uart_data->device) > 0) | |
389 #endif /* _SIMULATION_ */ | |
390 { | |
391 /* | |
392 * inform each channel about reading | |
393 */ | |
394 uart_data->rx.read_permission = TRUE; | |
395 for(i = 0; i <= UART_MAX_NUMBER_OF_CHANNELS; i++) | |
396 { | |
397 if(uart_data->dlc_table[i].receive_process EQ UART_RX_PROCESS_READY) | |
398 { | |
399 if(i EQ UART_CONTROL_INSTANCE) | |
400 { | |
401 /* | |
402 * Control channel | |
403 */ | |
404 sig_rx_ker_receiving_ind(); | |
405 } | |
406 else | |
407 { | |
408 /* | |
409 * Data channel | |
410 */ | |
411 uart_data->dtx = uart_data->dlc_table[i].dtx; | |
412 sig_rx_dtx_receiving_ind(); | |
413 } | |
414 } | |
415 } | |
416 } | |
417 else | |
418 uart_data->rx.read_permission = FALSE; | |
419 | |
420 if(uart_data EQ (&(uart_data_base[0]))) | |
421 { | |
422 TRACE_EVENT("UF_ReadData()"); | |
423 #ifdef _SIMULATION_ | |
424 rx_readdata(0); | |
425 #else /* _SIMULATION_ */ | |
426 UF_ReadData (uart_data->device, sm_suspend, rx_readOutFunc_0); | |
427 #endif /* else _SIMULATION_ */ | |
428 } | |
429 #ifdef FF_TWO_UART_PORTS | |
430 else if(uart_data EQ (&(uart_data_base[1]))) | |
431 { | |
432 TRACE_EVENT("UF_ReadData()"); | |
433 #ifdef _SIMULATION_ | |
434 rx_readdata(1); | |
435 #else /* _SIMULATION_ */ | |
436 UF_ReadData (uart_data->device, sm_suspend, rx_readOutFunc_1); | |
437 #endif /* else _SIMULATION_ */ | |
438 } | |
439 #endif /* FF_TWO_UART_PORTS */ | |
440 else | |
441 { | |
442 TRACE_ERROR("wrong value of uart_data"); | |
443 } | |
444 break; | |
445 | |
446 default: | |
447 TRACE_ERROR( "UART_DRIVER_RECEIVED_IND unexpected" ); | |
448 break; | |
449 } | |
450 } /* rx_uart_driver_received_ind() */ | |
451 | |
452 | |
453 | |
454 #ifdef _SIMULATION_ | |
455 /* | |
456 +------------------------------------------------------------------------------ | |
457 | Function : rx_dti_data_test_ind | |
458 +------------------------------------------------------------------------------ | |
459 | Description : Handles the primitive DTI_DATA_TEST_IND | |
460 | | |
461 | Parameters : *dti_data_test_ind - Ptr to primitive payload | |
462 | | |
463 +------------------------------------------------------------------------------ | |
464 */ | |
465 GLOBAL void rx_dti_data_test_ind ( T_DTI2_DATA_TEST_IND *dti_data_test_ind ) | |
466 { | |
467 char buf[100]; | |
468 T_reInstMode reInstall; | |
469 USHORT size[2]; | |
470 USHORT pos; | |
471 USHORT i; | |
472 T_UART_DATA* uart_device; | |
473 | |
474 TRACE_FUNCTION( "rx_dti_data_test_ind" ); | |
475 | |
476 /* | |
477 * set UART instance | |
478 */ | |
479 uart_device = &(uart_data_base[UART_TEST_C_ID_1]); | |
480 /* | |
481 * copy data to simulation buffer | |
482 */ | |
483 MFREE_DESC2(uart_device->rx.sim_buffer); | |
484 MALLOC(uart_device->rx.sim_buffer, (USHORT)(sizeof(T_desc2) - 1 + | |
485 (dti_data_test_ind->sdu.l_buf >> 3))); | |
486 memcpy(uart_device->rx.sim_buffer->buffer, | |
487 &dti_data_test_ind->sdu.buf[dti_data_test_ind->sdu.o_buf >> 3], | |
488 dti_data_test_ind->sdu.l_buf >> 3); | |
489 uart_device->rx.sim_buffer->len = dti_data_test_ind->sdu.l_buf >> 3; | |
490 uart_device->rx.sim_buffer->next = (ULONG)NULL; | |
491 uart_device->rx.sim_pos = 0; | |
492 /* | |
493 * trace output | |
494 */ | |
495 sprintf(buf, "UART device %d:", dti_data_test_ind->link_id); | |
496 TRACE_FUNCTION( buf ); | |
497 i = 0; | |
498 pos = uart_device->rx.sim_pos; | |
499 while(pos < uart_device->rx.sim_buffer->len) | |
500 { | |
501 i+= sprintf(&buf[i], "0x%02x, ", uart_device->rx.sim_buffer->buffer[pos]); | |
502 pos++; | |
503 if(i > 80) | |
504 { | |
505 TRACE_FUNCTION( buf ); | |
506 i = 0; | |
507 } | |
508 else if(pos >= uart_device->rx.sim_buffer->len) | |
509 { | |
510 TRACE_FUNCTION( buf ); | |
511 } | |
512 } | |
513 /* | |
514 * set values for ISR | |
515 */ | |
516 uart_device->rx.source[0] = &uart_device->rx.sim_buffer->buffer[ | |
517 uart_device->rx.sim_pos]; | |
518 uart_device->rx.source[1] = NULL; | |
519 size[0] = uart_device->rx.sim_buffer->len - | |
520 uart_device->rx.sim_pos; | |
521 size[1] = 0; | |
522 | |
523 /* | |
524 * call actual function | |
525 */ | |
526 rx_readOutFunc_0 (FALSE, &reInstall, 1, uart_device->rx.source, size, 0); | |
527 | |
528 /* | |
529 * store return values | |
530 */ | |
531 if(size[0] EQ 0) | |
532 { | |
533 MFREE_DESC2(uart_device->rx.sim_buffer); | |
534 uart_device->rx.sim_buffer = NULL; | |
535 } | |
536 else | |
537 uart_device->rx.sim_pos = uart_device->rx.sim_buffer->len - size[0]; | |
538 | |
539 /* | |
540 * free the primitive | |
541 */ | |
542 PFREE(dti_data_test_ind); | |
543 } /* rx_dti_data_test_ind() */ | |
544 | |
545 | |
546 | |
547 /* | |
548 +------------------------------------------------------------------------------ | |
549 | Function : rx_readdata | |
550 +------------------------------------------------------------------------------ | |
551 | Description : Simulates a UF_ReadData() call. | |
552 | | |
553 | Parameters : caller - calling UART instance | |
554 | | |
555 +------------------------------------------------------------------------------ | |
556 */ | |
557 GLOBAL void rx_readdata (UBYTE caller) | |
558 { | |
559 T_reInstMode reInstall; | |
560 USHORT size[2]; | |
561 T_UART_DATA* uart_device; | |
562 | |
563 TRACE_FUNCTION( "rx_readdata" ); | |
564 | |
565 /* | |
566 * set UART instance | |
567 */ | |
568 uart_device = &(uart_data_base[caller]); | |
569 | |
570 if(uart_device->rx.sim_buffer EQ NULL) | |
571 { | |
572 /* | |
573 * send DTI_GETDATA_REQ | |
574 */ | |
575 PALLOC (dti_getdata_req, DTI2_GETDATA_REQ); | |
576 dti_getdata_req->link_id = LINK_READDATA_PORT_1; /* for usual read_data */ | |
577 PSEND (hCommMMI, dti_getdata_req); | |
578 } | |
579 else | |
580 { | |
581 /* | |
582 * set values for ISR | |
583 */ | |
584 uart_device->rx.source[0] = NULL; | |
585 uart_device->rx.source[1] = &uart_device->rx.sim_buffer->buffer[ | |
586 uart_device->rx.sim_pos]; | |
587 size[0] = 0; | |
588 size[1] = uart_device->rx.sim_buffer->len - | |
589 uart_device->rx.sim_pos; | |
590 | |
591 /* | |
592 * call actual function | |
593 */ | |
594 if(caller EQ 0) | |
595 { | |
596 rx_readOutFunc_0 (FALSE, &reInstall, 2, uart_device->rx.source, size, 0); | |
597 } | |
598 #ifdef FF_TWO_UART_PORTS | |
599 else if(caller EQ 1) | |
600 { | |
601 rx_readOutFunc_1 (FALSE, &reInstall, 2, uart_device->rx.source, size, 0); | |
602 } | |
603 #endif /* FF_TWO_UART_PORTS */ | |
604 else | |
605 { | |
606 TRACE_ERROR("wrong caller value"); | |
607 } | |
608 | |
609 /* | |
610 * store return values | |
611 */ | |
612 if(size[1] EQ 0) | |
613 { | |
614 MFREE_DESC2(uart_device->rx.sim_buffer); | |
615 uart_device->rx.sim_buffer = NULL; | |
616 } | |
617 else | |
618 uart_device->rx.sim_pos = uart_device->rx.sim_buffer->len - size[1]; | |
619 } | |
620 } /* rx_readdata() */ | |
621 | |
622 | |
623 | |
624 /* | |
625 +------------------------------------------------------------------------------ | |
626 | Function : rx_inpavail | |
627 +------------------------------------------------------------------------------ | |
628 | Description : Simulates a UF_InpAvail() call. | |
629 | | |
630 | Parameters : caller - calling UART instance | |
631 | | |
632 | Return : number of octets in Input Queue | |
633 | | |
634 +------------------------------------------------------------------------------ | |
635 */ | |
636 GLOBAL USHORT rx_inpavail (UBYTE caller) | |
637 { | |
638 T_UART_DATA* uart_device; | |
639 | |
640 TRACE_FUNCTION( "rx_inpavail" ); | |
641 | |
642 /* | |
643 * set UART instance | |
644 */ | |
645 uart_device = &(uart_data_base[caller]); | |
646 | |
647 if(uart_device->rx.sim_buffer) | |
648 return uart_device->rx.sim_buffer->len - uart_device->rx.sim_pos; | |
649 else | |
650 return 0; | |
651 } /* rx_inpavail() */ | |
652 #endif /* _SIMULATION_ */ | |
653 #endif /* !FF_MULTI_PORT */ |