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