annotate gsm-fw/services/dar/dar_diagnose.c @ 992:a7b0b426f9ca

target-utils: boot ROM UART autodetection revamped The new implementation should work with both the familiar Calypso C035 boot ROM version found in our regular targets as well as the older Calypso F741979B version found on the vintage D-Sample board.
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Wed, 30 Dec 2015 21:28:41 +0000
parents 3c5a17928fda
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /****************************************************************************/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 /* */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 /* File Name: dar_diagnose.c */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 /* */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 /* Purpose: This function contains the DAR diagnose functions */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 /* */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 /* */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 /* Version 0.1 */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 /* */
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
10 /* Date Modification */
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 /* ------------------------------------ */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 /* 18 October 2001 Create */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 /* */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 /* Author Stephanie Gerthoux */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 /* */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 /****************************************************************************/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
19 #include "../../riviera/rv/rv_defined_swe.h"
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 #ifdef RVM_DAR_SWE
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 #ifndef _WINDOWS
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
22 #include "../../bsp/timer.h"
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 #endif
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
25 #include "../../riviera/rv/rv_general.h"
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
26 #include "../../riviera/rvm/rvm_gen.h"
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
27 #include "../../riviera/rvm/rvm_priorities.h"
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
28 #include "dar_api.h"
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
29 #include "dar_structs_i.h"
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
30 #include "dar_env.h"
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
31 #include "../../riviera/rvf/rvf_target.h"
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
32 #include "dar_const_i.h"
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
33 #include "dar_macro_i.h"
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
34 #include "dar_messages_i.h"
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
35 #include "dar_error_hdlr_i.h"
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 //#include "rvf/rvf_i.h"
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 /**** Global variables ****/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 /* Define a pointer to the Global Environment Control block */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 extern T_DAR_ENV_CTRL_BLK *dar_gbl_var_p;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
45 /***************************************************************************/
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
46 /* Function dar_search_group */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
47 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
48 /* Description This function checks if the use_id group_nb exists: */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
49 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
50 /***************************************************************************/
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 T_RV_RET dar_search_group(UINT16 group, UINT8 *index_p)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 /* Declare local variables */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 UINT8 i=0;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 /* Check if the DAR entity is started */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 if (dar_gbl_var_p != NULL )
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 /* Search in the dar_filter_array if the group exists */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 for (i=0;i< DAR_MAX_GROUP_NB; i++)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 if(dar_gbl_var_p->dar_filter_array[i].group_nb == group)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 *index_p=i;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 //DAR_SEND_TRACE_PARAM("dar filter_array index",*index_p,RV_TRACE_LEVEL_DEBUG_LOW);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 return(RV_OK);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 return(RV_NOT_SUPPORTED);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 else
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73 return(RV_NOT_READY);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
76
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
77 /***************************************************************************/
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
78 /* Function dar_add_group */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
79 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
80 /* Description This function research the index of the first free */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
81 /* group */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
82 /***************************************************************************/
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83 T_RV_RET dar_add_group(UINT8 *index_p)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85 /* Declare local variables */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 UINT8 i=0;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 /* Check if the DAR entity is started */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
89 if (dar_gbl_var_p == NULL )
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
90 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
91 dar_error_trace(DAR_ENTITY_NOT_START);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
92 return(RV_NOT_READY);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
93 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
94
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
95 /* Search in the dar_filter_array the first free group */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
96 for (i=0;i< DAR_MAX_GROUP_NB; i++)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
97 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
98 if(dar_gbl_var_p->dar_filter_array[i].group_nb == DAR_INITIALIZATION_VALUE)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
99 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
100 *index_p=i;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
101 return(RV_OK);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
102 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
103 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
104 return(RV_NOT_SUPPORTED);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
105 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
106
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
107
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
108 /***************************************************************************/
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
109 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
110 /* Function Name: dar_send_write_data */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
111 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
112 /* Purpose: This function is called to send write data in the DAR */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
113 /* mailbox. */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
114 /* Input Parameters: */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
115 /* Pointer to the message to store */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
116 /* Data Format, */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
117 /* Data level, */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
118 /* Data Use Id, */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
119 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
120 /* Output Parameters: */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
121 /* Validation of the function execution. */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
122 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
123 /* Note: */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
124 /* None */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
125 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
126 /***************************************************************************/
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
127
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
128 T_RV_RET dar_send_write_data ( T_DAR_INFO *buffer_p,
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
129 T_DAR_FORMAT format,
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
130 T_DAR_LEVEL diagnose_info_level,
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
131 T_RVM_USE_ID dar_use_id)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
132 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
133 /* Declare local variables */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
134 T_RVF_MB_STATUS mb_status = RVF_GREEN;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
135 T_DAR_WRITE_START *write_data_p = NULL;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
136
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
137 /************************** dar_send_write_data **********************/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
138
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
139 if (dar_gbl_var_p != NULL )
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
140 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
141 /* allocate the memory for the message to send */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
142 mb_status = rvf_get_buf (dar_gbl_var_p->mb_dar,
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
143 sizeof (T_DAR_WRITE_START),
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
144 (T_RVF_BUFFER **) (&write_data_p));
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
145
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
146 /* If insufficient resources, then report a memory error and abort.*/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
147 if (mb_status == RVF_YELLOW)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
148 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
149 /* deallocate the memory */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
150 rvf_free_buf((T_RVF_BUFFER *)write_data_p);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
151 dar_error_trace(DAR_ENTITY_NO_MEMORY);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
152 return (RV_NOT_SUPPORTED);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
153 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
154 else
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
155 if (mb_status == RVF_RED)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
156 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
157 dar_error_trace(DAR_ENTITY_NO_MEMORY);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
158 return (RV_MEMORY_ERR);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
159 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
160
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
161 /* fill the message id */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
162 write_data_p->os_hdr.msg_id = DAR_WRITE_REQ;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
163
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
164 /* fill the addr source id */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
165 write_data_p->os_hdr.src_addr_id = dar_gbl_var_p->addrId;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
166
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
167 /* fill the message parameters */
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
168 write_data_p->data_write.char_p = buffer_p ;
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
169 write_data_p->data_write.data_format = format;
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
170 write_data_p->data_write.level = diagnose_info_level;
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
171 write_data_p->data_write.use_id.group_nb = (dar_use_id>>16)& 0x7FFF;
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
172 write_data_p->data_write.use_id.mask = (dar_use_id)&0xFFFF;
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
173
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
174 /* send the messsage to the DAR entity */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
175 rvf_send_msg (dar_gbl_var_p->addrId,
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
176 write_data_p);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
177
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
178 return (RV_OK);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
179 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
180 else
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
181 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
182 return(RV_NOT_READY);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
183 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
184
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
185
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
186 } /* dar_send_write_data */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
187
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
188 /***************************************************************************/
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
189 /* Function dar_reset */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
190 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
191 /* Description This function is used to reset the system */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
192 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
193 /* Input Parameters: */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
194 /* None */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
195 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
196 /* Output Parameters: */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
197 /* Validation of the function execution. */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
198 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
199 /* Note: */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
200 /* None */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
201 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
202 /***************************************************************************/
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
203 T_RV_RET dar_reset(void)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
204 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
205 #ifndef _WINDOWS
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
206 /* Declare global variable*/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
207 volatile UINT16 *register_p;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
208 volatile UINT8 i;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
209
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
210
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
211 /* enable the Watchdog timer */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
212 TM_EnableWatchdog();
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
213
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
214 /* Reset the system with the Watchdog */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
215 /* initialize the adress of the watchdog timer pointer */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
216 register_p = (volatile UINT16 *)WATCHDOG_TIM_MODE;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
217
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
218 /* Write the 0xF5 value to the Watchdog timer mode register to disable
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
219 the Watchdog */
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
220 /* Note the bit 15 must be unchanged ( bit 15 = 1 -> 0x8000)*/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
221 *register_p =0x80F5;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
222
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
223 /* Wait a couple of time to be sure that this register has a new
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
224 value */
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
225 for (i=0;i<100;i++);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
226
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
227 /*
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
228 * After having received 0xF5 in the Watchdog timer mode register,
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
229 * if the second write access is differennt from 0xA0, ARM core is
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
230 * reset.
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
231 *
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
232 * The ARM HW core is reset + branch to adress 0x0000 ( SW reset)
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
233 */
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
234 *register_p=0x80F5;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
235
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
236 /* Wait until the ARM reset */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
237 while(1);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
238 #endif
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
239
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
240 return(RV_OK);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
241 } /* dar_reset */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
242
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
243
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
244 /***************************************************************************/
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
245 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
246 /* Function dar_read_mbox */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
247 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
248 /* Description Called by the dar to read a buffer from its mailboxes. */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
249 /* when the Operating System is out */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
250 /* Input Parameters: */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
251 /* None */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
252 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
253 /* Output Parameters: */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
254 /* NULL if the mailbox was empty, else the address of a buffer */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
255 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
256 /***************************************************************************/
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
257
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
258 void * dar_read_mbox (UINT8 mbox)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
259 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
260 // void * p_buf = NULL;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
261 // T_RVF_INTERNAL_BUF * p_hdr;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
262
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
263 /* Verify if DAR's global struct was set by RVM, then read the mailbox */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
264 if (dar_gbl_var_p != NULL )
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
265 return rvf_read_addr_mbox (dar_gbl_var_p->addrId, mbox);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
266
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
267 return NULL;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
268
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
269 // Check if the DAR entity is started
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
270 /*if (dar_gbl_var_p != NULL )
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
271 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
272
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
273 if ( OSTaskQFirst[dar_gbl_var_p->addrId][mbox] )// if the chained list is not empty
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
274 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
275 p_hdr = OSTaskQFirst[dar_gbl_var_p->addrId][mbox];
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
276 OSTaskQFirst[dar_gbl_var_p->addrId][mbox] = p_hdr->p_next;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
277
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
278 p_hdr->p_next = NULL;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
279
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
280 #if RVF_ENABLE_BUF_LINKAGE_CHECK
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
281 RVF_SET_BUF_UNLINKED(p_hdr); // change buffer status
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
282 #endif
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
283
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
284 p_buf = (UINT8 *)p_hdr + sizeof(T_RVF_INTERNAL_BUF);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
285 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
286 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
287 return (p_buf); */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
288 } // dar_read_mbox
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
289
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
290 #else
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
291
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
292 /* ******************************************************* */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
293 /* THE DAR ENTITY IS DISABLED */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
294 /* ******************************************************* */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
295 #ifndef _WINDOWS
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
296 #include "../../bsp/timer.h"
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
297 #endif
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
298
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
299 #include "../../riviera/rv/rv_general.h"
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
300 #include "../../riviera/rvm/rvm_gen.h"
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
301 #include "../../riviera/rvm/rvm_priorities.h"
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
302 #include "../../riviera/rvf/rvf_target.h"
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
303 //#include "rvf/rvf_i.h"
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
304
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
305 /* Define the Watchdog timer register mode */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
306 #define WATCHDOG_TIM_MODE (0xFFFFF804)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
307
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
308
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
309 /***************************************************************************/
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
310 /* Function dar_reset */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
311 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
312 /* Description This function is used to reset the system */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
313 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
314 /* Input Parameters: */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
315 /* None */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
316 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
317 /* Output Parameters: */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
318 /* Validation of the function execution. */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
319 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
320 /* Note: */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
321 /* None */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
322 /* */
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
323 /***************************************************************************/
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
324 T_RV_RET dar_reset(void)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
325 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
326 #ifndef _WINDOWS
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
327 /* Declare global variable*/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
328 volatile UINT16 *register_p;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
329 volatile UINT8 i;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
330
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
331
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
332 /* enable the Watchdog timer */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
333 TM_EnableWatchdog();
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
334
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
335 /* Reset the system with the Watchdog */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
336 /* initialize the adress of the watchdog timer pointer */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
337 register_p = (volatile UINT16 *)WATCHDOG_TIM_MODE;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
338
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
339 /* Write the 0xF5 value to the Watchdog timer mode register to disable
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
340 the Watchdog */
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
341 /* Note the bit 15 must be unchanged ( bit 15 = 1 -> 0x8000)*/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
342 *register_p =0x80F5;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
343
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
344 /* Wait a couple of time to be sure that this register has a new
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
345 value */
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
346 for (i=0;i<100;i++);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
347
308
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
348 /*
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
349 * After having received 0xF5 in the Watchdog timer mode register,
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
350 * if the second write access is differennt from 0xA0, ARM core is
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
351 * reset.
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
352 *
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
353 * The ARM HW core is reset + branch to adress 0x0000 ( SW reset)
3c5a17928fda DAR: starting to clean and compile .c files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
354 */
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
355 *register_p=0x80F5;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
356
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
357 /* Wait until the ARM reset */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
358 while(1);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
359 #endif
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
360
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
361 return(RV_OK);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
362 } /* dar_reset */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
363
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
364 #endif /* #ifdef RVM_DAR_SWE */