FreeCalypso > hg > tcs211-fcmodem
comparison chipsetsw/drivers/drv_app/r2d/r2d_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 | |
3 @file: r2d_env.c | |
4 | |
5 @author Christophe Favergeon | |
6 | |
7 @version 0.5 | |
8 | |
9 Purpose: Environment for the software entity | |
10 of Riviera 2D system (higher software layer) | |
11 | |
12 */ | |
13 | |
14 /* | |
15 | |
16 Date Modification | |
17 ------------------------------------ | |
18 06/02/2001 Create | |
19 10/18/2001 Version 0.5 for first integration with Riviera database | |
20 | |
21 | |
22 (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved | |
23 */ | |
24 | |
25 | |
26 #include "rv/general.h" | |
27 | |
28 #include "rvm/rvm_gen.h" | |
29 #include "rvm/rvm_ext_priorities.h" | |
30 #include "rvm/rvm_use_id_list.h" | |
31 | |
32 | |
33 #include "r2d/r2d.h" | |
34 #include "r2d/r2d_env.h" | |
35 #include "r2d/r2d_messages.h" | |
36 #include "r2d/uwire.h" | |
37 | |
38 #include <string.h> | |
39 | |
40 | |
41 extern void r2d_core(UINT32 param); | |
42 | |
43 /* global pointer to the error function */ | |
44 T_RVM_RETURN (*r2d_error_ft)(T_RVM_NAME swe_name, T_RVM_RETURN error_cause, \ | |
45 T_RVM_ERROR_TYPE error_type,T_RVM_STRING error_msg); | |
46 | |
47 | |
48 | |
49 /* global addr id */ | |
50 T_RVF_ADDR_ID r2d_addr_id; | |
51 | |
52 | |
53 | |
54 /* global memory bank ID */ | |
55 T_RVF_MB_ID r2d_mb_id; | |
56 | |
57 /* Global standard graphical context */ | |
58 T_R2D_GC_PTR r2d_g_lcd_gc=NULL; | |
59 | |
60 /* For communication with the task */ | |
61 T_R2D_EVT * p_msg; | |
62 | |
63 extern T_RVM_RETURN r2d_initializations(void); | |
64 extern T_RVM_RETURN r2d_cleanup(); | |
65 extern UINT32 r2d_get_memory_bank_size(); | |
66 /****************************************************************************** | |
67 * Function : xxx_get_info | |
68 * | |
69 * Description : This function is called by the RV manager to learn | |
70 * xxx requirements in terms of memory, SWEs... | |
71 * | |
72 * Parameters : T_RVM_INFO_SWE * swe_info: pointer to the structure to fill | |
73 * containing infos related to the xxx SWE. | |
74 * | |
75 * Return : T_RVM_RETURN | |
76 * | |
77 * History : 0.1 (20-August-2000) | |
78 * | |
79 * | |
80 ******************************************************************************/ | |
81 T_RVM_RETURN r2d_get_info(T_RVM_INFO_SWE * infoSWE) | |
82 { | |
83 | |
84 /* SWE info */ | |
85 | |
86 memcpy ( (UINT8 *) infoSWE->type_info.type4.swe_name, "R2D", 4); | |
87 infoSWE->swe_type = RVM_SWE_TYPE_4; | |
88 infoSWE->type_info.type4.stack_size=R2D_STACK_SIZE; | |
89 infoSWE->type_info.type4.priority=RVM_R2D_TASK_PRIORITY; | |
90 infoSWE->type_info.type4.swe_use_id=R2D_USE_ID; | |
91 | |
92 | |
93 | |
94 | |
95 /* memory bank info */ | |
96 infoSWE->type_info.type4.nb_mem_bank= 1; | |
97 | |
98 | |
99 | |
100 memcpy ((UINT8 *) infoSWE->type_info.type4.mem_bank[0].bank_name, "R2D_PRIM", 9); | |
101 infoSWE->type_info.type4.mem_bank[0].initial_params.size = r2d_get_memory_bank_size(); | |
102 infoSWE->type_info.type4.mem_bank[0].initial_params.watermark = r2d_get_memory_bank_size()-1000; | |
103 | |
104 | |
105 /* linked SWE info */ | |
106 /* this SWE does not require any SWE to run */ | |
107 infoSWE->type_info.type4.nb_linked_swe = 0; | |
108 | |
109 | |
110 /* generic functions */ | |
111 infoSWE->type_info.type4.set_info=r2d_set_info; | |
112 infoSWE->type_info.type4.init = r2d_init; | |
113 infoSWE->type_info.type4.stop = r2d_stop; | |
114 infoSWE->type_info.type4.kill = r2d_kill; | |
115 infoSWE->type_info.type4.core = r2d_start; | |
116 | |
117 | |
118 return RVM_OK; | |
119 } | |
120 | |
121 | |
122 /****************************************************************************** | |
123 * Function : xxx_set_info | |
124 * | |
125 * Description : This function is called by the RV manager to inform | |
126 * the xxx SWE about task_id, mb_id and error function. | |
127 * | |
128 * Parameters : - T_RVM_TASK_ID taskId[]: array of task_id. | |
129 * taskId[0] contains xxx task_id. | |
130 * - T_RVF_MB_ID mbId[]: array of memory bank ids. | |
131 * - callback function to call in case of unrecoverable error. | |
132 * | |
133 * Return : T_RVM_RETURN | |
134 * | |
135 * History : 0.1 (20-August-2000) | |
136 * | |
137 * | |
138 ******************************************************************************/ | |
139 T_RVM_RETURN r2d_set_info ( T_RVF_ADDR_ID addr_id, | |
140 T_RV_RETURN return_path[], | |
141 T_RVF_MB_ID bk_id_table[], | |
142 T_RVM_CB_FUNC call_back_error_ft) | |
143 | |
144 | |
145 { | |
146 | |
147 /* store the pointer to the error function */ | |
148 r2d_error_ft = call_back_error_ft ; | |
149 | |
150 r2d_addr_id=addr_id; | |
151 | |
152 | |
153 /* Store MB id */ | |
154 r2d_mb_id = bk_id_table[0]; | |
155 | |
156 /* return_path of linked SWE -> not used */ | |
157 | |
158 return RVM_OK; | |
159 } | |
160 | |
161 | |
162 | |
163 | |
164 /****************************************************************************** | |
165 * Function : xxx_start | |
166 * | |
167 * Description : This function is called by the RV manager to start the xxx | |
168 * SWE, it is the body of the task. | |
169 * | |
170 * Parameters : None | |
171 * | |
172 * Return : T_RVM_RETURN | |
173 * | |
174 * History : 0.1 (20-August-2000) | |
175 * | |
176 * | |
177 ******************************************************************************/ | |
178 T_RVM_RETURN r2d_start(void) | |
179 { | |
180 /* | |
181 ** Branch to main task core | |
182 */ | |
183 if (r2d_g_lcd_gc!=NULL) | |
184 { | |
185 r2d_erase(r2d_g_lcd_gc); | |
186 r2d_core(0); | |
187 return RV_OK; | |
188 } | |
189 else | |
190 return RV_MEMORY_ERR; | |
191 } | |
192 | |
193 | |
194 | |
195 /****************************************************************************** | |
196 * Function : xxx_stop | |
197 * | |
198 * Description : This function is called by the RV manager to stop the xxx SWE. | |
199 * | |
200 * Parameters : None | |
201 * | |
202 * Return : T_RVM_RETURN | |
203 * | |
204 * History : 0.1 (20-August-2000) | |
205 * | |
206 * | |
207 ******************************************************************************/ | |
208 T_RVM_RETURN r2d_stop(void) | |
209 { | |
210 /* | |
211 ** other SWEs have not been killed yet, xxx can send messages to other SWEs | |
212 */ | |
213 return RVM_OK; | |
214 } | |
215 | |
216 /****************************************************************************** | |
217 * Function : xxx_kill | |
218 * | |
219 * Description : This function is called by the RV manager to kill the xxx | |
220 * SWE, after the xxx_stop function has been called. | |
221 * | |
222 * Parameters : None | |
223 * | |
224 * Return : T_RVM_RETURN | |
225 * | |
226 * History : 0.1 (20-August-2000) | |
227 * | |
228 * | |
229 ******************************************************************************/ | |
230 T_RVM_RETURN r2d_kill (void) | |
231 { | |
232 r2d_cleanup(); | |
233 return RV_OK; | |
234 } | |
235 | |
236 | |
237 | |
238 | |
239 /****************************************************************************** | |
240 * Function : xxx_init | |
241 * | |
242 * Description : This function is called by the RV manager to initialize the | |
243 * xxx SWE before creating the task and calling xxx_start. | |
244 * | |
245 * Parameters : None | |
246 * | |
247 * Return : T_RVM_RETURN | |
248 * | |
249 * History : 0.1 (20-August-2000) | |
250 * | |
251 * | |
252 ******************************************************************************/ | |
253 T_RVM_RETURN r2d_init(void) | |
254 { | |
255 return(r2d_initializations()); | |
256 } | |
257 |