annotate gsm-fw/riviera/rvt/rvt_task.c @ 160:dbfc9ff4e8d2

gsm-fw: starting to compile RTC code
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 17 Nov 2013 22:52:52 +0000
parents afceeeb2cba1
children 4b53bd08f345
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /**************************************************************************
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 *
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 * rvt_task.c
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 *
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 * This contains the core of the Trace task.
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 *
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 * (C) Texas Instruments, all rights reserved
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 *
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 * Version number : 0.1
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 *
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 * History : 0.1 (7/5/2000) - Created
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 *
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 * Date : 7/5/2000
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 *
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 * Author : Guido Pagana
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 *
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 * Update : Pascal Puel
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 * : David Lamy-Charrier (changes for Riviera 1.6)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 *
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 ***************************************************************************/
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21
122
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 118
diff changeset
22 #include "../../include/config.h"
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23
122
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 118
diff changeset
24 #include "../rv/general.h"
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 118
diff changeset
25 #include "../rv/rv_general.h"
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 118
diff changeset
26 #include "../rvf/rvf_api.h"
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 118
diff changeset
27 #include "rvt_gen.h"
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 118
diff changeset
28 #include "rvt_def_i.h"
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 118
diff changeset
29 #include "rvt_env.h"
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 118
diff changeset
30 #include "rvt_env_i.h"
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 118
diff changeset
31 #include "../rvm/rvm_use_id_list.h"
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32
122
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 118
diff changeset
33 #include "../../serial/serialswitch.h"
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34
122
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 118
diff changeset
35 #include "../../nucleus/nucleus.h"
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 #include <string.h>
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 extern NU_HISR TI_rcv_HISR;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 /* Time (in milliseconds) between two consecutive 'System Time' messages */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 #define RVT_ALIVE_POLLING_TIME (RVF_MS_TO_TICKS (20000))
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 #define RVT_WAIT_FOR_HEADER (1)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 #define RVT_WAIT_FOR_DATA (2)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 /********************************************************************************/
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 /* Function Name: rvt_task_core */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 /* Purpose: Core of Trace task. */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 /* Input Parameters: */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 /* None. */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 /* Output Parameters: */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 /* None. */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 /* Global Parameters: */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 /* None. */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 /* Note: */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 /* None. */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 /********************************************************************************/
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 T_RVM_RETURN rvt_task_core (void)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 {
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
69 UINT16 event = 0;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
70 UINT32 nb_bytes_sent = 0;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
71
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
72 #ifdef FRAMING_PROTOCOL
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
74 // Request for the level of filtering, as well as the 32-bit
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
75 // mask related to the software entities to be monitored.
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
76 {
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
77 UINT8 trace_level_request[] = {RVM_INVALID_USE_ID, 0, 0, 0, 0,
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
78 (RV_TRACE_LEVEL_ERROR - 1), 0, 0, 0, 0};
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
79
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
80 // Note that the level is defined as invalid
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
81 trace_level_request[0] = (char) rv_trace_user_id;
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
82
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
83 // Transmit an 'empty' message
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
84 nb_bytes_sent = 0;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
85 while (nb_bytes_sent < sizeof (trace_level_request))
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 {
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
87 nb_bytes_sent += SER_tr_WriteNBytes (SER_LAYER_1,
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
88 trace_level_request + nb_bytes_sent,
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
89 sizeof (trace_level_request) -
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
90 nb_bytes_sent);
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
91 }
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
92 }
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
93
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
94 // Start the 'Alive Polling Timer'
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
95 #if (OP_WCP == 0)
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
96 rvf_start_timer (RVF_TIMER_0,
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
97 RVT_ALIVE_POLLING_TIME,
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
98 TRUE);
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
99 #endif
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
100
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
101 for (; ; )
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
102 {
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
103 // Infinite wait on 'Trace Task' mailbox or timer events
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
104 event = rvf_wait ((1 << RVT_TRACE_MAILBOX) | (RVF_TIMER_0_EVT_MASK),
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
105 0);
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
106
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
107 // Check for some messages lost
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
108 if (((rvt_lost_msg_cpt.bit_mask).count >= RVT_MAX_LOST_TRACE_MSG)
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
109 && (p_rvt_lost_msg))
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
110 {
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
111 INT8 count = 0;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
112 UINT8 lost_msg_length = RVT_HDR_LENGTH + RVT_LOST_MSG_LENGTH;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
113 UINT32 lost_msg_cpt = rvt_lost_msg_cpt.overall_value;
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
114
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
115 // Append with the number of messages lost
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
116 rvt_lost_msg_cpt.overall_value = 0;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
117 for (count = 0;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
118 count < RVT_HEX_VALUE_LENGTH;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
119 count++)
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
120 {
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
121 p_rvt_lost_msg[lost_msg_length + count] =
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
122 Num2Char[(UINT8) ((lost_msg_cpt << (count << 2)) >> 28)];
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
123 }
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
124 lost_msg_length += RVT_HEX_VALUE_LENGTH;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
125
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
126 // Send message to the UART with byte stuffing
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
127 nb_bytes_sent = 0;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
128 while (nb_bytes_sent < lost_msg_length)
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
129 {
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
130 nb_bytes_sent += SER_tr_WriteNBytes (SER_LAYER_1,
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
131 (UINT8 *) p_rvt_lost_msg + nb_bytes_sent,
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
132 lost_msg_length - nb_bytes_sent);
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
133 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
134
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
135 } // End of if ((rvt_lost_msg_cpt.bit_mask).count >= RVT_MAX_LOST_TRACE_MSG)
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
137 if (event & EVENT_MASK (RVT_TRACE_MAILBOX))
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
138 {
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
139 T_RV_HDR *msg = NULL;
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
140
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
141 // Read the message from the mailbox
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
142 if ((msg = (T_RV_HDR *) rvf_read_mbox (RVT_TRACE_MAILBOX))
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
143 != NULL)
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
144 {
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
145 if (msg->msg_id == RVT_TRACE_RQST_ID)
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
146 {
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
147 UINT8 msg_format = 0;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
148 UINT32 msg_length = 0;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
149
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
150 // Get the length
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
151 msg_length = ((T_RVT_TRACE_RQST *) msg)->msg_length;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
152
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
153 // Get the format
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
154 msg_format = ((T_RVT_TRACE_RQST *) msg)->format;
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
155
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
156 // Copy the 'User ID'
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
157 ((UINT8 *) msg + RVT_HEADER_SIZE - 1)[0] =
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
158 ((T_RVT_TRACE_RQST *) msg)->user_id;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
159 msg_length++;
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
160
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
161 switch (msg_format)
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
162 {
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
163 case RVT_ASCII_FORMAT:
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
164 {
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
165 // Send message to the UART without byte stuffing
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
166 nb_bytes_sent = 0;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
167 while (nb_bytes_sent < msg_length)
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
168 {
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
169 nb_bytes_sent += SER_tr_EncapsulateNChars
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
170 (SER_LAYER_1,
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
171 (char *) msg + RVT_HEADER_SIZE - 1 +
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
172 nb_bytes_sent,
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
173 msg_length - nb_bytes_sent);
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
174 }
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
175 break;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
176 }
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
177 case RVT_BINARY_FORMAT:
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
178 {
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
179 // Send message to the UART with byte stuffing
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
180 nb_bytes_sent = 0;
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
181 while (nb_bytes_sent < msg_length)
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
182 {
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
183 nb_bytes_sent += SER_tr_WriteNBytes
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
184 (SER_LAYER_1,
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
185 (UINT8 *) msg + RVT_HEADER_SIZE
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
186 - 1 + nb_bytes_sent,
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
187 msg_length - nb_bytes_sent);
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
188 }
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
189 break;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
190 }
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
191 default:
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
192 {
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
193 // Increment the number of messages lost.
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
194 // Is the buffer corrupted?
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
195 (rvt_lost_msg_cpt.bit_mask).count++;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
196 (rvt_lost_msg_cpt.bit_mask).unknown_format = 1;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
197 break;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
198 }
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
199 }
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
200
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
201 // Deallocate the buffer
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
202 rvf_free_buf (msg);
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
203
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
204 } // End of if (msg->msg_id == RVT_TRACE_RQST_ID)
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
205 else
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
206 {
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
207 // Increment the number of messages lost. Is the buffer
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
208 // corrupted?
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
209 (rvt_lost_msg_cpt.bit_mask).count++;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
210 (rvt_lost_msg_cpt.bit_mask).unknown_request = 1;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
211 }
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
212
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
213 } // End of if (msg != NULL)
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
214 else
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
215 {
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
216 // Increment the number of messages lost. Is the buffer
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
217 // corrupted?
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
218 (rvt_lost_msg_cpt.bit_mask).count++;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
219 (rvt_lost_msg_cpt.bit_mask).message_empty = 1;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
220 }
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
221
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
222 } // End of if (event & EVENT_MASK (RVT_TRACE_MAILBOX))
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
223
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
224 if ((event & (RVF_TIMER_0_EVT_MASK)) && (p_rvt_sys_time))
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
225 {
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
226 UINT8 count = 0;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
227 UINT8 sys_time_length = RVT_HDR_LENGTH + RVT_SYS_TIME_LENGTH;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
228 UINT32 current_time = rvf_get_tick_count ();
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
229
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
230 // Append with the system time
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
231 for (count = 0;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
232 count < RVT_HEX_VALUE_LENGTH;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
233 count++)
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
234 {
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
235 p_rvt_sys_time[sys_time_length + count] =
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
236 Num2Char[(UINT8) ((current_time << (count << 2)) >> 28)];
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
237 }
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
238 sys_time_length += RVT_HEX_VALUE_LENGTH;
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
239
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
240 // Send message to the UART with byte stuffing
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
241 nb_bytes_sent = 0;
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
242 while (nb_bytes_sent < sys_time_length)
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
243 {
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
244 nb_bytes_sent += SER_tr_WriteNBytes (SER_LAYER_1,
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
245 (UINT8 *) p_rvt_sys_time + nb_bytes_sent,
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
246 sys_time_length - nb_bytes_sent);
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
247 }
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
248
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
249 } // End of if (event & (RVF_TIMER_0_EVT_MASK))
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
250 //freecalypso_lldbg_intinfo();
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
251 }
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
252
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
253 #else
122
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 118
diff changeset
254
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
255 // Start the 'Alive Polling Timer'
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
256 #if (OP_WCP == 0)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
257 rvf_start_timer (RVF_TIMER_0,
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
258 RVT_ALIVE_POLLING_TIME,
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
259 TRUE);
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
260 #endif
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
261
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
262 for (;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
263 ;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
264 )
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
265 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
266 // Infinite wait on 'Trace Task' mailbox or timer events
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
267 event = rvf_wait ((1 << RVT_TRACE_MAILBOX) | (RVF_TIMER_0_EVT_MASK),
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
268 0);
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
269
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
270 // Check for some messages lost
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
271 if (((rvt_lost_msg_cpt.bit_mask).count >= RVT_MAX_LOST_TRACE_MSG) && (p_rvt_lost_msg))
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
272 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
273 INT8 count = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
274 UINT8 lost_msg_length = RVT_LOST_MSG_LENGTH;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
275 UINT32 lost_msg_cpt = rvt_lost_msg_cpt.overall_value;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
276
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
277 // Append with the number of messages lost
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
278 rvt_lost_msg_cpt.overall_value = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
279 for (count = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
280 count < RVT_HEX_VALUE_LENGTH;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
281 count ++)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
282 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
283 p_rvt_lost_msg[lost_msg_length + count] = Num2Char[(UINT8) ((lost_msg_cpt << (count << 2)) >> 28)];
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
284 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
285 rvt_lost_msg_length += RVT_HEX_VALUE_LENGTH;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
286
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
287 // Append with the '\n' and '\r' characters for the hyper terminal
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
288 p_rvt_lost_msg[lost_msg_length++] = '\n';
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
289 p_rvt_lost_msg[lost_msg_length++] = '\r';
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
290
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
291 // Send the message to the UART without byte stuffing
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
292 nb_bytes_sent = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
293 while (nb_bytes_sent < lost_msg_length)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
294 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
295 nb_bytes_sent += SER_tr_WriteNChars (SER_LAYER_1,
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
296 (UINT8 *) p_rvt_lost_msg + nb_bytes_sent,
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
297 lost_msg_length - nb_bytes_sent);
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
298 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
299
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
300 } // End of if ((rvt_lost_msg_cpt.bit_mask).count >= RVT_MAX_LOST_TRACE_MSG)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
301
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
302 if (event & EVENT_MASK (RVT_TRACE_MAILBOX))
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
303 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
304 T_RV_HDR *msg = NULL;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
305
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
306 // Read the message from the mailbox
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
307 if ((msg = (T_RV_HDR *) rvf_read_mbox (RVT_TRACE_MAILBOX)) != NULL)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
308 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
309 if (msg->msg_id == RVT_TRACE_RQST_ID)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
310 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
311 UINT32 msg_length = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
312
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
313 // Get the length
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
314 msg_length = ((T_RVT_TRACE_RQST *) msg)->msg_length;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
315
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
316 // Send message to the UART without byte stuffing
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
317 nb_bytes_sent = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
318 while (nb_bytes_sent < msg_length)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
319 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
320 nb_bytes_sent += SER_tr_WriteNChars (SER_LAYER_1,
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
321 msg + RVT_HEADER_SIZE + nb_bytes_sent,
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
322 msg_length - nb_bytes_sent);
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
323 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
324
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
325 // Append with the '\n' and '\r' characters for the hyper terminal
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
326 msg_length = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
327 msg[msg_length++] = '\n';
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
328 msg[msg_length++] = '\r';
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
329
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
330 // Send message to the UART without byte stuffing
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
331 nb_bytes_sent = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
332 while (nb_bytes_sent < msg_length)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
333 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
334 nb_bytes_sent += SER_tr_WriteNChars (SER_LAYER_1,
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
335 msg + nb_bytes_sent,
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
336 msg_length - nb_bytes_sent);
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
337 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
338
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
339 // Deallocate the buffer
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
340 rvf_free_buf (msg);
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
341
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
342 } // End of if (msg->msg_id == RVT_TRACE_RQST_ID)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
343
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
344 else
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
345 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
346 // Increment the number of messages lost. Is the buffer
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
347 // corrupted?
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
348 (rvt_lost_msg_cpt.bit_mask).count++;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
349 (rvt_lost_msg_cpt.bit_mask).unknown_request = 1;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
350 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
351
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
352 } // End of if (msg != NULL)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
353
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
354 else
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
355 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
356 // Increment the number of messages lost. Is the buffer
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
357 // corrupted?
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
358 (rvt_lost_msg_cpt.bit_mask).count++;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
359 (rvt_lost_msg_cpt.bit_mask).message_empty = 1;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
360 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
361
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
362 } // End of if (event & EVENT_MASK (RVT_TRACE_MAILBOX))
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
363
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
364 if ((event & (RVF_TIMER_0_EVT_MASK)) && (p_rvt_sys_time))
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
365 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
366 UINT8 count = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
367 UINT8 sys_time_length = RVT_SYS_TIME_LENGTH;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
368 UINT32 current_time = rvf_get_tick_count ();
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
369
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
370 // Append with the system time
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
371 for (count = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
372 count < RVT_HEX_VALUE_LENGTH;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
373 count++)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
374 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
375 p_rvt_sys_time[sys_time_length + count] = Num2Char[(UINT8) ((current_time << (count << 2)) >> 28)];
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
376 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
377 sys_time_length += RVT_HEX_VALUE_LENGTH;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
378
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
379 // Append with the '\n' and '\r' characters for the hyper terminal
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
380 p_rvt_sys_time[sys_time_length++] = '\n';
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
381 p_rvt_sys_time[sys_time_length++] = '\r';
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
382
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
383 // Send message to the UART without byte stuffing
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
384 nb_bytes_sent = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
385 while (nb_bytes_sent < sys_time_length)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
386 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
387 nb_bytes_sent += SER_tr_WriteNChars (SER_LAYER_1,
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
388 (UINT8 *) p_rvt_sys_time + nb_bytes_sent,
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
389 sys_time_length - nb_bytes_sent);
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
390 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
391
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
392 } // End of if (event & (RVF_TIMER_0_EVT_MASK))
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
393 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
394 #endif
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
395 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
396
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
397
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
398 /********************************************************************************/
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
399 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
400 /* Function Name: rvt_RX_process */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
401 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
402 /* Purpose: This function is called when characters are received */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
403 /* on the serial port on receive HISR. */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
404 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
405 /* Input Parameters: */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
406 /* None. */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
407 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
408 /* Output Parameters: */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
409 /* None. */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
410 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
411 /* Global Parameters: */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
412 /* None. */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
413 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
414 /* Note: */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
415 /* None. */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
416 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
417 /********************************************************************************/
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
418 void rvt_RX_process (void)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
419 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
420 UINT32 bytesRead;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
421 static UINT8 inBuffer[255];
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
422
136
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
423 rvf_send_trace("Ser RX", 6, rvf_get_tick_count(),
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
424 RV_TRACE_LEVEL_DEBUG_HIGH, RVT_USE_ID);
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
425 /*
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
426 freecalypso_raw_dbgout("*Ser_RX");
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
427 freecalypso_lldbg_intinfo();
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
428 */
3b5c3f3646fb RV bring-up: lack of timer ticks fixed,
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 122
diff changeset
429
118
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
430 #ifdef FRAMING_PROTOCOL
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
431 BOOL eof = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
432 static UINT8 rcv_state = RVT_WAIT_FOR_HEADER;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
433 static UINT32 total_bytesRead = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
434 static RVT_CALLBACK_FUNC rx_callback_func = NULL;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
435
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
436 // Get all bytes from the UART RX FIFO
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
437 for (;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
438 ;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
439 )
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
440 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
441 // Read and destuff the UART RX FIFO and fill inBuffer with received
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
442 // bytes
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
443 bytesRead = SER_tr_ReadNBytes (SER_LAYER_1,
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
444 (char *) (inBuffer + total_bytesRead),
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
445 sizeof (inBuffer) - total_bytesRead,
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
446 &eof);
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
447
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
448 // Check for the header. Hence, get the sendee
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
449 if ((rcv_state == RVT_WAIT_FOR_HEADER) && \
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
450 (bytesRead) && \
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
451 !(total_bytesRead))
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
452 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
453 if ((inBuffer[0] == RVT_RV_HEADER) || \
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
454 (inBuffer[0] == RVT_L1_HEADER) || \
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
455 (inBuffer[0] == RVT_L23_HEADER) || \
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
456 (inBuffer[0] == RVT_TM_HEADER) || \
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
457 (inBuffer[0] == RVT_RNET_HEADER) || \
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
458 (inBuffer[0] == RVT_PROF_HEADER) || \
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
459 (inBuffer[0] == RVT_GTTBACK_HEADER) || \
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
460 (inBuffer[0] == RVT_OTHER_HEADER))
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
461 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
462 UINT8 idtab = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
463
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
464 // Search for the ID in the table
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
465 for (idtab = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
466 rvt_user_db[idtab].user_id != RVT_INVALID_HEADER;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
467 idtab++)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
468 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
469 if (rvt_user_db[idtab].user_id == inBuffer[0])
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
470 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
471 rx_callback_func = rvt_user_db[idtab].rx_callback_func;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
472 break;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
473 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
474 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
475 rcv_state = RVT_WAIT_FOR_DATA;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
476 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
477 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
478
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
479 // Update the total number of bytes read, regarding the current frame
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
480 total_bytesRead += bytesRead;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
481
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
482 // Call the corresponding callback function when a complete message is
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
483 // received (eof odd)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
484 if (eof & 0x01)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
485 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
486 // Invoke the callback function
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
487 if (rx_callback_func != NULL)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
488 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
489 rx_callback_func ((T_RVT_BUFFER) (inBuffer + 1),
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
490 total_bytesRead - 1);
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
491 rx_callback_func = NULL;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
492 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
493
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
494 // Wait for the next frame to come
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
495 rcv_state = RVT_WAIT_FOR_HEADER;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
496 total_bytesRead = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
497 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
498
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
499 // inBuffer may be full due to some synchro lost problems
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
500 else if (total_bytesRead == sizeof (inBuffer))
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
501 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
502 // If still waiting for the header, discard received characters and
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
503 // reset static variables for the next frame to come
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
504 if (rcv_state == RVT_WAIT_FOR_HEADER)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
505 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
506 total_bytesRead = 0;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
507 break;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
508 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
509
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
510 // Just discard characters received as payload
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
511 total_bytesRead = sizeof (inBuffer[0]);
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
512 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
513
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
514 // Proceed with the next concatenated frame whether more bytes left
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
515 if (eof > 1)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
516 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
517 continue;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
518 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
519 break;
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
520 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
521 #else
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
522
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
523 // Read the UART RX FIFO and fill inBuffer with received bytes
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
524 bytesRead = SER_tr_ReadNChars (SER_LAYER_1,
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
525 (char *) inBuffer,
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
526 sizeof (inBuffer));
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
527
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
528 // Invoke the Testmode callback function : this is the only one able,
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
529 // for the moment, to send an external command !! WARNING : This
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
530 // should be the same name than the one already registered in
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
531 // create_RVtasks.c.
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
532 tm_receive ((T_RVT_BUFFER) inBuffer,
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
533 bytesRead);
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
534 #endif
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
535 }
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
536
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
537
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
538
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
539 /********************************************************************************/
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
540 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
541 /* Function Name: rvt_activate_RX_HISR */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
542 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
543 /* Purpose: This function is called when an RX interrupt occurs. */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
544 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
545 /* Input Parameters: */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
546 /* None. */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
547 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
548 /* Output Parameters: */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
549 /* None. */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
550 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
551 /* Global Parameters: */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
552 /* None. */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
553 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
554 /* Note: */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
555 /* None. */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
556 /* */
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
557 /********************************************************************************/
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
558 void rvt_activate_RX_HISR (void)
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
559 {
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
560 NU_Activate_HISR (&TI_rcv_HISR);
21de8d8e6ea7 checking in Riviera code from the Sotomodem version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
561 }