annotate gsm-fw/services/dar/dar_task.c @ 522:2c9c2b95ddec

FC version of l1_rf12.c compiles
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 13 Jul 2014 07:48:14 +0000
parents a7087f91c752
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_task.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 is the main function. It contains the dar_core */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 /* which waits for messages or function calls. */
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 /* */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 /* Version 0.1 */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 /* */
309
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
11 /* Date Modification */
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 /* ------------------------------------ */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 /* 16 October 2001 Create */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 /* */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 /* Author Stephanie Gerthoux */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 /* */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 /* (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
18 /****************************************************************************/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19
309
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
20 #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
21 #ifdef RVM_DAR_SWE
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 #ifndef _WINDOWS
309
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
23 #include "../../include/config.h"
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 #endif
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 #include <string.h>
309
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
27 #include "../../riviera/rvm/rvm_gen.h"
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
28 #include "../../riviera/rvm/rvm_use_id_list.h"
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
29 #include "dar_api.h"
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
30 #include "dar_macro_i.h"
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
31 #include "dar_handle_message.h"
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
32 #include "dar_structs_i.h"
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
33 #include "dar_error_hdlr_i.h"
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
34 #include "dar_const_i.h"
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35
309
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
36 #include "../ffs/ffs_api.h"
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
37
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 /* Variables definitions */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 T_DAR_RECOVERY_STATUS status=0;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 /**** Global variables ****/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 /* 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
43 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
44
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 /* Write buffer*/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 extern char dar_write_buffer[DAR_MAX_BUFFER_SIZE];
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 /* index used in the circular buffer*/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 extern UINT16 dar_current_index;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 /* DAR previous status : to get the status of the last exception */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 extern UINT8 dar_previous_exception;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 /* Ram buffer that contains the Debug Unit register */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 extern UINT32 debug_RAM[DEBUG_UNIT_WORD_SIZE];
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 /* X_dump buffer defined in the command file */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 /* This buffer contains the general register, the PC, the CPSR....*/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 #ifndef _WINDOWS
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 extern INT32 xdump_buffer;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 #endif
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63
309
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
64 /***************************************************************************/
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
65 /* Function dar_core */
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
66 /* */
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
67 /* Description Core of the dar task, which scans the dar mailbox and */
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
68 /* waits for messages. When a message arrives, it sends it*/
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
69 /* to proper functions */
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
70 /* */
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
71 /* */
a7087f91c752 DAR: all C modules compile without RVM_DAR_SWE
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 305
diff changeset
72 /***************************************************************************/
305
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 T_RV_RET dar_core(void)
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 /* Declare local variables */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 /**** Structs ****/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
78 /* File descriptor type */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 T_FFS_FD ffs_fd;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
80
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
81 /* Variables */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
82 T_RV_RET error_status = RV_OK;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83 T_RV_HDR *msg_p = NULL;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 UINT16 received_event = 0x0000;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85 char dar_ffs[20];
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 char dar_dir_ffs[20];
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87 char dar_subdir_ffs[20];
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 BOOL dar_ffs_error = FALSE;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
89
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
90 #ifndef _WINDOWS
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
91 /* Define the Link register and the CPSR */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
92 INT32 *link_register_p = &(xdump_buffer) + 14;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
93 INT32 *dar_spsr_p = &(xdump_buffer) + 16;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
94 UINT16 i;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
95 #endif
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
96
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
97 /* Dar_ffs file name */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
98 strcpy(dar_dir_ffs,"/var");
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
99 strcpy(dar_subdir_ffs,"/var/dbg");
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
100
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
101 #ifndef _WINDOWS
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
102 strcpy(dar_ffs,"/var/dbg/dar");
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
103 #else
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
104 strcpy(dar_ffs,"\var\dbg\dar");
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
105 #endif
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 DAR_SEND_TRACE("DAR_TASK started",RV_TRACE_LEVEL_DEBUG_HIGH);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
108
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
109 /*---------------------------------*/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
110 /* FFS */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
111 /*---------------------------------*/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
112
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
113 /**** create the dar ffs directories ****/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
114 if ((ffs_mkdir(dar_dir_ffs) != EFFS_OK) && (ffs_mkdir(dar_dir_ffs) != EFFS_EXISTS))
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
115 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
116 DAR_SEND_TRACE("DAR entity can't create the '/var' folder into the flash",RV_TRACE_LEVEL_ERROR);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
117 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
118
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
119 if ((ffs_mkdir(dar_subdir_ffs) != EFFS_OK) && (ffs_mkdir(dar_subdir_ffs) != EFFS_EXISTS))
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
120 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
121 DAR_SEND_TRACE("DAR entity can't create the '/var/dbg' folder into the flash",RV_TRACE_LEVEL_ERROR);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
122 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
123
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
124
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
125 /**** create the ffs file ****/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
126 ffs_fd = ffs_open(dar_ffs, FFS_O_CREATE | FFS_O_WRONLY | FFS_O_TRUNC | FFS_O_APPEND);
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 if (ffs_fd < 0)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
129 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
130 DAR_SEND_TRACE("DAR entity has received wrong file name or the flash is not formatted",RV_TRACE_LEVEL_WARNING);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
131 dar_ffs_error = TRUE;
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
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
134 #ifndef _WINDOWS
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
135
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
136 /**** Save the RAM buffer into the FFS ****/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
137 /* save the buffer in 2 parts in order to have the information in chronological order */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
138 /* save the oldest information : from dar_current_index to the end of the buffer*/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
139 if ((ffs_write (ffs_fd,
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
140 (void *)(&dar_write_buffer + dar_current_index),
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
141 (DAR_MAX_BUFFER_SIZE - dar_current_index))) < 0 & (dar_ffs_error == FALSE))
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
142 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
143 DAR_SEND_TRACE("DAR entity can't saved the file in flash",RV_TRACE_LEVEL_WARNING);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
144 }
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 /* save the rest of information: from the beginning of the buffer to dar_current_index */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
147 if ((ffs_write (ffs_fd,
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
148 (void *)(&dar_write_buffer),
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
149 (dar_current_index))) < 0 & (dar_ffs_error == FALSE))
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
150 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
151 DAR_SEND_TRACE("DAR entity can't saved the file in flash",RV_TRACE_LEVEL_WARNING);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
152 }
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 /* Erase the dar_write_buffer */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
155 for (i=0;i<DAR_MAX_BUFFER_SIZE; i++)
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_write_buffer[i] = 0;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
158 }
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 /**** Save the X_dump_buffer into the Flash. ****/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
161 /* This buffer is defined in the command file */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
162 /* And the size of this buffer is defined in the gsm_cs_amd4_lj3_test.cmd */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
163 /* its size is 38*32 bits = 38*4 bytes = 152 bytes */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
164 if ((ffs_write (ffs_fd,
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
165 (void *)(&xdump_buffer),
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
166 (DAR_X_DUMP_BUFFER_SIZE))) < 0 & (dar_ffs_error == FALSE))
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
167 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
168 DAR_SEND_TRACE("DAR entity can't saved the X_dump_buffer in flash",RV_TRACE_LEVEL_WARNING);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
169 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
170
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
171 /**** Save the Debug Unit Register into the Flash if necessary (Abort or prefetch)****/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
172 /* A Prefetch abort exception or a data abort exception is generated */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
173 #if ((CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 10) || (CHIPSET == 11))
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
174 if ((dar_previous_exception == DAR_EXCEPTION_PREFETCH_ABORT) ||
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
175 (dar_previous_exception == DAR_EXCEPTION_DATA_ABORT))
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
176 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
177 /* Save the Debug Unit into the Flash */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
178 if ((ffs_write (ffs_fd,
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
179 (void *) &debug_RAM,
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
180 (4*DEBUG_UNIT_WORD_SIZE))) < 0 & (dar_ffs_error == FALSE))
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 DAR_SEND_TRACE("DAR entity can't saved the DEBUG UNIT in flash",RV_TRACE_LEVEL_WARNING);
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 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
185 #endif
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
186
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
187 #else
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
188 /* save the buffer in 2 parts in order to have the information in chronological order */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
189 /* save the oldest information : from dar_current_index to the end of the buffer*/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
190 if ((ffs_write (ffs_fd,
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
191 (&dar_write_buffer + dar_current_index),
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
192 (DAR_MAX_BUFFER_SIZE - dar_current_index))) != EFFS_OK)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
193 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
194 DAR_SEND_TRACE("DAR entity can't saved the file in flash",RV_TRACE_LEVEL_WARNING);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
195 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
196 /* save the rest of information: from the beginning of the buffer to dar_current_index */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
197 if ((ffs_write (ffs_fd,
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
198 (&dar_write_buffer),
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
199 (dar_current_index))) != EFFS_OK)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
200 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
201 DAR_SEND_TRACE("DAR entity can't saved the file in flash",RV_TRACE_LEVEL_WARNING);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
202 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
203 /* The X_dump_buffer and the Debug Unit can't be saved on the PC */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
204 #endif
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
205
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
206 /* Close the ffs file*/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
207 #ifndef _WINDOWS
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
208 if ( ffs_close(ffs_fd) != EFFS_OK & (dar_ffs_error == FALSE))
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 DAR_SEND_TRACE("DAR entity has not closed the file",RV_TRACE_LEVEL_WARNING);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
211 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
212 #else
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
213 if ( ffs_close(ffs_fd) != EFFS_OK )
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
214 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
215 dar_error_trace(DAR_ENTITY_FILE_NO_CLOSE);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
216 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
217 #endif
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
218
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
219 #ifndef _WINDOWS
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
220 /**** Save the LR and the SPSR when an exception has occured ****/
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
221 if ((dar_previous_exception == DAR_EXCEPTION_PREFETCH_ABORT)||
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
222 (dar_previous_exception == DAR_EXCEPTION_DATA_ABORT) ||
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
223 (dar_previous_exception == DAR_EXCEPTION_UNDEFINED) ||
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
224 (dar_previous_exception == DAR_EXCEPTION_SWI) ||
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
225 (dar_previous_exception == DAR_EXCEPTION_RESERVED))
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
226 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
227 /* Displays the Link register saved on exception */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
228 DAR_SEND_TRACE_PARAM("Link register = ", *link_register_p,RV_TRACE_LEVEL_DEBUG_HIGH);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
229
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
230 /* Displays the User mode CPSR saved on exception */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
231 DAR_SEND_TRACE_PARAM("User mode SPSR before the exception=", *dar_spsr_p,RV_TRACE_LEVEL_DEBUG_HIGH);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
232 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
233
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
234 /* Displays the status of the last reset of the system */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
235 dar_recovery_get_status(&status);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
236 #endif
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
237
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
238 /* ------------------------------------------- */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
239 /* loop to process messages */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
240 /* ------------------------------------------- */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
241 while (error_status == RV_OK)
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 /* Wait for all events. */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
244 received_event = rvf_wait(DAR_ALL_EVENT_FLAGS, DAR_NOT_TIME_OUT);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
245
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
246 if (received_event & DAR_TASK_MBOX_EVT_MASK)
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
247 {
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
248 /* Read the message in the Dar mailbox and handle it. */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
249 msg_p = (T_RV_HDR *) rvf_read_mbox(DAR_MBOX);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
250 error_status = dar_handle_msg(msg_p);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
251 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
252 }
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
253
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
254 /* If one of the occured events is unexpected (due to an unassigned */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
255 /* mailbox), then report an internal error. */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
256 if (received_event & ~(DAR_TASK_MBOX_EVT_MASK ))
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 DAR_SEND_TRACE(" DAR ERROR (env). One of the occured events is unexpected ",
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
259 RV_TRACE_LEVEL_ERROR);
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
260
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
261 error_status = RV_NOT_SUPPORTED;
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
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
264 /* If a memory error happened .. */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
265 if (error_status == RV_MEMORY_ERR)
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 dar_gbl_var_p->callBackFctError("DAR",
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
268 RVM_MEMORY_ERR,
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
269 0,
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
270 " Memory Error : the DAR primitive memory bank is RED ");
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 return RV_OK;
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
274 } /* dar_core */
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
275
4dccc9d3305f gsm-fw: checking in DAR from Leonardo source
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
276 #endif /* #ifdef RVM_DAR_SWE */