comparison src/cs/services/dar/dar_api.h @ 0:b6a5e36de839

src/cs: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:39:26 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:b6a5e36de839
1 /****************************************************************************/
2 /* */
3 /* File Name: dar_api.h */
4 /* */
5 /* Purpose: This file contains data structures and functions prototypes */
6 /* used to send events to the DAR SWE. */
7 /* */
8 /* Version 0.1 */
9 /* */
10 /* Date Modification */
11 /* ------------------------------------ */
12 /* 26 September 2001 Create */
13 /* */
14 /* Author Stephanie Gerthoux */
15 /* */
16 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
17 /****************************************************************************/
18
19 #include "rv/rv_defined_swe.h"
20 #include "rvm/rvm_api.h"
21
22 /* file used in recovery case */
23 #include "main/sys_types.h"
24
25 #include "dar/dar_gen.h"
26
27 #ifdef RVM_DAR_SWE
28
29 #ifndef __DAR_API_H_
30 #define __DAR_API_H_
31
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #endif
36
37 /***** Events *****/
38 #define DAR_EVENTS_MASK (0x5000)
39 #define DAR_EVENT_EXTERN (0x0C00)
40
41 /***** Definitions *****/
42 /*Define DAR use parameters */
43 typedef struct
44 {
45 UINT16 group_nb;
46 UINT16 mask;
47 }T_DAR_USE_ID;
48
49 typedef struct
50 {
51 T_RV_HDR os_hdr;
52 INT8 status;
53 } T_DAR_STATUS;
54
55 /********************************************************************************/
56 /* RECOVERY */
57 /********************************************************************************/
58
59 /***** Events *****/
60 #define DAR_RECOVERY_CONFIG (0x0001|DAR_EVENT_EXTERN)
61
62 /***** Definitions ******/
63 /* Define return parameters. */
64 typedef UINT16 T_DAR_RECOVERY_STATUS;
65 /* possible values */
66 #define DAR_POWER_ON_OFF (0x0) /* Power ON/OFF */
67 #define DAR_WATCHDOG (0xDD11) /* Watchdog reset */
68 #define DAR_NORMAL_SCUTTLING (0xDD22) /* Recovery module has decided to active the reset */
69 #define DAR_EMERGENCY_SCUTTLING (0xDD33) /* Emergency detection */
70
71 /* Define Recovery configuration parameters */
72 typedef struct{
73 UINT16 msg_id; /* id of the message */
74 T_DAR_BUFFER buffer_p; /* pointer on the buffer */
75 UINT8 length; /* buffer length */
76 } T_DAR_RECOVERY_CONFIG;
77
78 /* Define register parameters */
79 #define DAR_NAME_MAX_LEN (15)
80 typedef char T_DAR_NAME[DAR_NAME_MAX_LEN];
81
82 /***** Prototype *****/
83 /* Get and reset the status of the DAR entity */
84 T_RV_RET dar_recovery_get_status(T_DAR_RECOVERY_STATUS* status);
85 T_RV_RET dar_recovery_config(T_RV_RET (*dar_store_recovery_data)( T_DAR_BUFFER buffer_p,
86 UINT16 length));
87 T_RV_RET dar_get_recovery_data(T_DAR_BUFFER buffer_p,UINT16 length );
88
89 /********************************************************************************/
90 /* WATCHDOG */
91 /********************************************************************************/
92
93 /***** Prototype *****/
94 T_RV_RET dar_start_watchdog_timer(UINT16 timer);
95 T_RV_RET dar_reload_watchdog_timer(void);
96 T_RV_RET dar_stop_watchdog_timer(void);
97
98
99 /********************************************************************************/
100 /* RESET */
101 /********************************************************************************/
102
103 /***** Prototype *****/
104 T_RV_RET dar_reset_system(void);
105
106
107 /********************************************************************************/
108 /* DIAGNOSE */
109 /********************************************************************************/
110
111 /***** Definitions *****/
112
113 /* DAR level messages value ( Error, Warning or debug ) */
114 /* define with 8 bits: - the first for Error level */
115 /* - the second for Warning level */
116 /* - the other bits for debug level*/
117
118 /* Error level : 1000 0000 in binary*/
119 #define DAR_ERROR (0x80)
120 /* Warning level : 0100 0000 in binary*/
121 #define DAR_WARNING (0x40)
122 /* Debug level : 0000 0001 in binary*/
123 #define DAR_DEBUG (0x01)
124 /* None level : 0000 0000 in binary*/
125 #define DAR_NO_DIAGNOSE (0x00)
126 /* Exception level 1111 1111 in binary*/
127 #define DAR_EXCEPTION (0xFF)
128 /* Causes a reset, if set when calling dar_diagnose_write_emergency() */
129 #define DAR_EMERGENCY_RESET (0x00000001)
130 /* New data is appended to last entry, if set when calling dar_diagnose_write_emergency() */
131 #define DAR_NEW_ENTRY (0x00000002)
132
133 /***** Prototype *****/
134 /* Diagnose prototypes */
135 T_RV_RET dar_diagnose_swe_filter ( T_RVM_USE_ID dar_use_id,
136 T_DAR_LEVEL dar_level);
137
138 T_RV_RET dar_diagnose_write( T_DAR_INFO *buffer_p,
139 T_DAR_FORMAT format,
140 T_DAR_LEVEL diagnose_info_level,
141 T_RVM_USE_ID dar_use_id);
142
143 T_RV_RET dar_diagnose_write_emergency( T_DAR_INFO *buffer_p,
144 T_DAR_FORMAT format,
145 T_RVM_USE_ID dar_use_id,
146 UINT32 flags);
147
148 T_RV_RET dar_diagnose_generate_emergency( T_DAR_INFO *buffer_p,
149 T_DAR_FORMAT format,
150 T_RVM_USE_ID dar_use_id);
151
152 #ifdef __cplusplus
153 }
154 #endif
155
156 #endif /* __DAR_API_H_ */
157 #endif /* #ifdef RVM_DAR_SWE */