FreeCalypso > hg > fc-magnetite
comparison src/cs/services/etm/etm_env.c @ 109:45ceec943347
src/cs/services/etm/etm_{api,env}.c: non-8-character tab cleanup
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 05 Oct 2016 23:44:54 +0000 |
parents | 945cf7f506b2 |
children | 49254db81128 |
comparison
equal
deleted
inserted
replaced
108:94170d82d926 | 109:45ceec943347 |
---|---|
1 /******************************************************************************** | 1 /******************************************************************************** |
2 * Enhanced TestMode (ETM) | 2 * Enhanced TestMode (ETM) |
3 * @file etm_env.c | 3 * @file etm_env.c |
4 * | 4 * |
5 * @author Kim T. Peteren (ktp@ti.com) | 5 * @author Kim T. Peteren (ktp@ti.com) |
6 * @version 0.1 | 6 * @version 0.1 |
7 * | 7 * |
8 | 8 |
9 * | 9 * |
10 * History: | 10 * History: |
11 * | 11 * |
12 * Date Modification | 12 * Date Modification |
13 * ------------------------------------ | 13 * ------------------------------------ |
14 * 16/06/2003 Creation | 14 * 16/06/2003 Creation |
15 * | 15 * |
16 * (C) Copyright 2003 by Texas Instruments Incorporated, All Rights Reserved | 16 * (C) Copyright 2003 by Texas Instruments Incorporated, All Rights Reserved |
17 *********************************************************************************/ | 17 *********************************************************************************/ |
18 | 18 |
19 | 19 |
38 */ | 38 */ |
39 T_ETM_ENV_CTRL_BLK *etm_env_ctrl_blk = NULL; | 39 T_ETM_ENV_CTRL_BLK *etm_env_ctrl_blk = NULL; |
40 | 40 |
41 | 41 |
42 /****************************************************************************** | 42 /****************************************************************************** |
43 * Function : etm_get_info | 43 * Function : etm_get_info |
44 * | 44 * |
45 * Description : This function is called by the RV manager to learn | 45 * Description : This function is called by the RV manager to learn |
46 * driver requirements in terms of memory, SWEs... | 46 * driver requirements in terms of memory, SWEs... |
47 * | 47 * |
48 * Parameters : T_RVM_INFO_SWE * swe_info: pointer to the structure to fill | 48 * Parameters : T_RVM_INFO_SWE * swe_info: pointer to the structure to fill |
49 * containing infos related to the driver SWE. | 49 * containing infos related to the driver SWE. |
50 * | 50 * |
51 * Return : T_RVM_RETURN | 51 * Return : T_RVM_RETURN |
52 * | 52 * |
53 * History : 0.1 | 53 * History : 0.1 |
54 * | 54 * |
55 * | 55 * |
56 ******************************************************************************/ | 56 ******************************************************************************/ |
57 T_RVM_RETURN etm_get_info(T_RVM_INFO_SWE *swe_info) | 57 T_RVM_RETURN etm_get_info(T_RVM_INFO_SWE *swe_info) |
58 { | 58 { |
59 /* SWE info */ | 59 /* SWE info */ |
60 swe_info->swe_type = RVM_SWE_TYPE_4; | 60 swe_info->swe_type = RVM_SWE_TYPE_4; |
61 swe_info->type_info.type4.swe_use_id = ETM_USE_ID; | 61 swe_info->type_info.type4.swe_use_id = ETM_USE_ID; |
62 | 62 |
63 memcpy(swe_info->type_info.type4.swe_name, "ETM", sizeof("ETM")); | 63 memcpy(swe_info->type_info.type4.swe_name, "ETM", sizeof("ETM")); |
64 swe_info->type_info.type4.stack_size = ETM_STACK_SIZE; | 64 swe_info->type_info.type4.stack_size = ETM_STACK_SIZE; |
65 swe_info->type_info.type4.priority = RVM_ETM_TASK_PRIORITY; | 65 swe_info->type_info.type4.priority = RVM_ETM_TASK_PRIORITY; |
66 | 66 |
67 /* Set the return path */ | 67 /* Set the return path */ |
68 swe_info->type_info.type4.return_path.callback_func = NULL; | 68 swe_info->type_info.type4.return_path.callback_func = NULL; |
69 swe_info->type_info.type4.return_path.addr_id = 0; | 69 swe_info->type_info.type4.return_path.addr_id = 0; |
70 | 70 |
71 /* memory bank info */ | 71 /* memory bank info */ |
72 swe_info->type_info.type4.nb_mem_bank = 1; | 72 swe_info->type_info.type4.nb_mem_bank = 1; |
73 | 73 |
74 memcpy (swe_info->type_info.type4.mem_bank[0].bank_name, "ETM_PRIM", 9); | 74 memcpy (swe_info->type_info.type4.mem_bank[0].bank_name, "ETM_PRIM", 9); |
75 swe_info->type_info.type4.mem_bank[0].initial_params.size = ETM_MB_PRIM_SIZE; | 75 swe_info->type_info.type4.mem_bank[0].initial_params.size = ETM_MB_PRIM_SIZE; |
76 swe_info->type_info.type4.mem_bank[0].initial_params.watermark = ETM_MB_PRIM_WATERMARK; | 76 swe_info->type_info.type4.mem_bank[0].initial_params.watermark = ETM_MB_PRIM_WATERMARK; |
77 | 77 |
78 /* linked SWE info */ | 78 /* linked SWE info */ |
79 /* this SWE requires the ATP SWE to run */ | 79 /* this SWE requires the ATP SWE to run */ |
80 #ifdef RVM_ATP_SWE | 80 #ifdef RVM_ATP_SWE |
81 swe_info->type_info.type4.nb_linked_swe = 1; | 81 swe_info->type_info.type4.nb_linked_swe = 1; |
82 swe_info->type_info.type4.linked_swe_id[0] = ATP_USE_ID; | 82 swe_info->type_info.type4.linked_swe_id[0] = ATP_USE_ID; |
83 #else | 83 #else |
84 swe_info->type_info.type4.nb_linked_swe = 0; | 84 swe_info->type_info.type4.nb_linked_swe = 0; |
85 #endif | 85 #endif |
86 | 86 |
87 /* generic functions */ | 87 /* generic functions */ |
88 swe_info->type_info.type4.set_info = etm_set_info; | 88 swe_info->type_info.type4.set_info = etm_set_info; |
89 swe_info->type_info.type4.init = etm_init; | 89 swe_info->type_info.type4.init = etm_init; |
90 swe_info->type_info.type4.core = etm_start; | 90 swe_info->type_info.type4.core = etm_start; |
91 swe_info->type_info.type4.stop = etm_stop; | 91 swe_info->type_info.type4.stop = etm_stop; |
92 swe_info->type_info.type4.kill = etm_kill; | 92 swe_info->type_info.type4.kill = etm_kill; |
93 | 93 |
94 return RVM_OK; | 94 return RVM_OK; |
95 } | 95 } |
96 | 96 |
97 | 97 |
98 /****************************************************************************** | 98 /****************************************************************************** |
99 * Function : etm_set_info | 99 * Function : etm_set_info |
100 * | 100 * |
101 * Description : This function is called by the RV manager to inform | 101 * Description : This function is called by the RV manager to inform |
102 * the driver SWE about task_id, mb_id and error function. | 102 * the driver SWE about task_id, mb_id and error function. |
103 * | 103 * |
104 * Parameters : - T_RVF_ADDR_ID addr_id: unique path to the SWE. | 104 * Parameters : - T_RVF_ADDR_ID addr_id: unique path to the SWE. |
105 * - T_RV_RETURN ReturnPath[], array of return path for linked SWE | 105 * - T_RV_RETURN ReturnPath[], array of return path for linked SWE |
106 * - T_RVF_MB_ID mbId[]: array of memory bank ids. | 106 * - T_RVF_MB_ID mbId[]: array of memory bank ids. |
107 * - callback function to call in case of unrecoverable error. | 107 * - callback function to call in case of unrecoverable error. |
108 * | 108 * |
109 * Return : T_RVM_RETURN | 109 * Return : T_RVM_RETURN |
110 * | 110 * |
111 * History : 0.1 | 111 * History : 0.1 |
112 * | 112 * |
113 * | 113 * |
114 ******************************************************************************/ | 114 ******************************************************************************/ |
115 | 115 |
116 T_RVM_RETURN etm_set_info (T_RVF_ADDR_ID addr_id, | 116 T_RVM_RETURN etm_set_info (T_RVF_ADDR_ID addr_id, |
117 T_RV_RETURN return_path[], | 117 T_RV_RETURN return_path[], |
118 T_RVF_MB_ID bk_id[], | 118 T_RVF_MB_ID bk_id[], |
119 T_RVM_RETURN (*rvm_error_ft)(T_RVM_NAME swe_name, | 119 T_RVM_RETURN (*rvm_error_ft)(T_RVM_NAME swe_name, |
120 T_RVM_RETURN error_cause, | 120 T_RVM_RETURN error_cause, |
121 T_RVM_ERROR_TYPE error_type, | 121 T_RVM_ERROR_TYPE error_type, |
122 T_RVM_STRING error_msg)) | 122 T_RVM_STRING error_msg)) |
123 { | 123 { |
124 /* Create instance gathering all the variable used by EXPL instance */ | 124 /* Create instance gathering all the variable used by EXPL instance */ |
125 if (rvf_get_buf(bk_id[0], | 125 if (rvf_get_buf(bk_id[0], |
126 sizeof(T_ETM_ENV_CTRL_BLK), | 126 sizeof(T_ETM_ENV_CTRL_BLK), |
127 (T_RVF_BUFFER**)&etm_env_ctrl_blk) != RVF_GREEN) | 127 (T_RVF_BUFFER**)&etm_env_ctrl_blk) != RVF_GREEN) |
128 { | 128 { |
129 /* The environemnt will cancel the ETM instance creation. */ | 129 /* The environemnt will cancel the ETM instance creation. */ |
130 return RVM_MEMORY_ERR; | 130 return RVM_MEMORY_ERR; |
131 } | 131 } |
132 | 132 |
133 | 133 |
134 /* Store the pointer to the error function */ | 134 /* Store the pointer to the error function */ |
135 etm_env_ctrl_blk->error_ft = rvm_error_ft ; | 135 etm_env_ctrl_blk->error_ft = rvm_error_ft ; |
136 /* Store the mem bank id. */ | 136 /* Store the mem bank id. */ |
137 etm_env_ctrl_blk->prim_id = bk_id[0]; | 137 etm_env_ctrl_blk->prim_id = bk_id[0]; |
138 /* Store the addr id */ | 138 /* Store the addr id */ |
139 etm_env_ctrl_blk->addr_id = addr_id; | 139 etm_env_ctrl_blk->addr_id = addr_id; |
140 | 140 |
141 /* | 141 /* |
142 * Task ID (task_id) and Memory bank ID (mb_id) can be retrieved later | 142 * Task ID (task_id) and Memory bank ID (mb_id) can be retrieved later |
143 * using rvf_get_taskid and rvf_get_mb_id functions. | 143 * using rvf_get_taskid and rvf_get_mb_id functions. |
144 */ | 144 */ |
145 | 145 |
146 /* return_path of linked SWE -> not used */ | 146 /* return_path of linked SWE -> not used */ |
147 | 147 |
148 return RVM_OK; | 148 return RVM_OK; |
149 } | 149 } |
150 | 150 |
151 | 151 |
152 /****************************************************************************** | 152 /****************************************************************************** |
153 * Function : etm_init | 153 * Function : etm_init |
154 * | 154 * |
155 * Description : This function is called by the RV manager to initialize the | 155 * Description : This function is called by the RV manager to initialize the |
156 * etm SWE before creating the task and calling etm_start. | 156 * etm SWE before creating the task and calling etm_start. |
157 * | 157 * |
158 * Parameters : None | 158 * Parameters : None |
159 * | 159 * |
160 * Return : T_RVM_RETURN | 160 * Return : T_RVM_RETURN |
161 * | 161 * |
162 * History : 0.1 (20-August-2000) | 162 * History : 0.1 (20-August-2000) |
163 * | 163 * |
164 * | 164 * |
165 ******************************************************************************/ | 165 ******************************************************************************/ |
166 | 166 |
167 T_RVM_RETURN etm_init(void) | 167 T_RVM_RETURN etm_init(void) |
168 { | 168 { |
169 return RVM_OK; | 169 return RVM_OK; |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 /****************************************************************************** | 173 /****************************************************************************** |
174 * Function : etm_start | 174 * Function : etm_start |
175 * | 175 * |
176 * Description : This function is called by the RV manager to start the etm | 176 * Description : This function is called by the RV manager to start the etm |
177 * SWE, it is the body of the task. | 177 * SWE, it is the body of the task. |
178 * | 178 * |
179 * Parameters : None | 179 * Parameters : None |
180 * | 180 * |
181 * Return : T_RVM_RETURN | 181 * Return : T_RVM_RETURN |
182 * | 182 * |
183 * History : 0.1 | 183 * History : 0.1 |
184 * | 184 * |
185 * | 185 * |
186 ******************************************************************************/ | 186 ******************************************************************************/ |
187 | 187 |
188 T_RVM_RETURN etm_start(void) | 188 T_RVM_RETURN etm_start(void) |
189 { | 189 { |
190 etm_task(); | 190 etm_task(); |
191 return RV_OK; | 191 return RV_OK; |
192 } | 192 } |
193 | 193 |
194 | 194 |
195 /****************************************************************************** | 195 /****************************************************************************** |
196 * Function : etm_stop | 196 * Function : etm_stop |
197 * | 197 * |
198 * Description : This function is called by the RV manager to stop the etm SWE. | 198 * Description : This function is called by the RV manager to stop the etm SWE. |
199 * | 199 * |
200 * Parameters : None | 200 * Parameters : None |
201 * | 201 * |
202 * Return : T_RVM_RETURN | 202 * Return : T_RVM_RETURN |
203 * | 203 * |
204 * History : 0.1 | 204 * History : 0.1 |
205 * | 205 * |
206 ******************************************************************************/ | 206 ******************************************************************************/ |
207 | 207 |
208 T_RVM_RETURN etm_stop(void) | 208 T_RVM_RETURN etm_stop(void) |
209 { | 209 { |
210 return RVM_OK; | 210 return RVM_OK; |
211 } | 211 } |
212 | 212 |
213 /****************************************************************************** | 213 /****************************************************************************** |
214 * Function : etm_kill | 214 * Function : etm_kill |
215 * | 215 * |
216 * Description : This function is called by the RV manager to kill the etm | 216 * Description : This function is called by the RV manager to kill the etm |
217 * SWE, after the etm_stop function has been called. | 217 * SWE, after the etm_stop function has been called. |
218 * | 218 * |
219 * Parameters : None | 219 * Parameters : None |
220 * | 220 * |
221 * Return : T_RVM_RETURN | 221 * Return : T_RVM_RETURN |
222 * | 222 * |
223 * History : 0.1 | 223 * History : 0.1 |
224 * | 224 * |
225 * | 225 * |
226 ******************************************************************************/ | 226 ******************************************************************************/ |
227 | 227 |
228 T_RVM_RETURN etm_kill (void) | 228 T_RVM_RETURN etm_kill (void) |
229 { | 229 { |
230 rvf_free_buf(etm_env_ctrl_blk); | 230 rvf_free_buf(etm_env_ctrl_blk); |
231 return RVM_OK; | 231 return RVM_OK; |
232 } | 232 } |