FreeCalypso > hg > freecalypso-citrine
comparison services/ffs/ffs_env.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /****************************************************************************/ | |
2 /* */ | |
3 /* File Name: ffs_env.c */ | |
4 /* */ | |
5 /* Purpose: This file contains definitions for RV manager related */ | |
6 /* functions used to get info, start and stop the FFS SWE. */ | |
7 /* */ | |
8 /* Version 0.1 */ | |
9 /* */ | |
10 /* Date Modification */ | |
11 /* ------------------------------------ */ | |
12 /* 10/24/2000 Create */ | |
13 /* */ | |
14 /* Author Pascal Puel */ | |
15 /* */ | |
16 /* (C) Copyright 2000 by Texas Instruments Incorporated, All Rights Reserved*/ | |
17 /****************************************************************************/ | |
18 | |
19 #include "../../include/config.h" | |
20 #include "ffs.h" | |
21 #include "ffs_env.h" | |
22 #include "../../riviera/rvm/rvm_gen.h" | |
23 #include "../../riviera/rvm/rvm_priorities.h" | |
24 #include "../../riviera/rvm/rvm_use_id_list.h" | |
25 #include "task.h" | |
26 #include <string.h> | |
27 | |
28 extern void ffs_task_init(T_RVF_MB_ID mbid, T_RVF_ADDR_ID addr_id); | |
29 T_FFS_TASK_INFO ffs_task_info; | |
30 | |
31 /* global pointer to the error function */ | |
32 static T_RVM_RETURN (*ffs_error_ft)(T_RVM_NAME swe_name, | |
33 T_RVM_RETURN error_cause, | |
34 T_RVM_ERROR_TYPE error_type, | |
35 T_RVM_STRING error_msg); | |
36 | |
37 /****************************************************************************** | |
38 * Function : ffs_get_info | |
39 * | |
40 * Description : This function is called by the RV manager to learn | |
41 * driver requirements in terms of memory, SWEs... | |
42 * | |
43 * Parameters : T_RVM_INFO_SWE * swe_info: pointer to the structure to fill | |
44 * containing infos related to the driver SWE. | |
45 * | |
46 * Return : T_RVM_RETURN | |
47 * | |
48 * History : 0.1 (20-August-2000) | |
49 * | |
50 * | |
51 ******************************************************************************/ | |
52 T_RVM_RETURN ffs_get_info(T_RVM_INFO_SWE * infoSWE) | |
53 { | |
54 | |
55 /* SWE info */ | |
56 infoSWE->swe_type = RVM_SWE_TYPE_4; | |
57 | |
58 infoSWE->type_info.type4.swe_use_id = FFS_USE_ID; | |
59 memcpy ( (UINT8 *) infoSWE->type_info.type4.swe_name, "FFS", sizeof("FFS") ); | |
60 infoSWE->type_info.type4.version = 0; | |
61 | |
62 infoSWE->type_info.type4.stack_size = FFS_STACK_SIZE; | |
63 infoSWE->type_info.type4.priority = RVM_FFS_TASK_PRIORITY; | |
64 | |
65 /* memory bank info */ | |
66 infoSWE->type_info.type4.nb_mem_bank = 1; | |
67 | |
68 memcpy ((UINT8 *) infoSWE->type_info.type4.mem_bank[0].bank_name, "FFS_PRIM", RVM_NAME_MAX_LEN); | |
69 infoSWE->type_info.type4.mem_bank[0].initial_params.size = FFS_MB_PRIM_SIZE; | |
70 infoSWE->type_info.type4.mem_bank[0].initial_params.watermark = FFS_MB_PRIM_WATERMARK; | |
71 | |
72 /* linked SWE info */ | |
73 infoSWE->type_info.type4.nb_linked_swe = 0; | |
74 | |
75 /* generic functions */ | |
76 infoSWE->type_info.type4.set_info = ffs_set_info; | |
77 infoSWE->type_info.type4.init = ffs_init; | |
78 infoSWE->type_info.type4.core = ffs_start; | |
79 infoSWE->type_info.type4.stop = ffs_stop; | |
80 infoSWE->type_info.type4.kill = ffs_kill; | |
81 | |
82 /* Set return_path */ | |
83 infoSWE->type_info.type4.return_path.callback_func = NULL; | |
84 infoSWE->type_info.type4.return_path.addr_id = 0; | |
85 | |
86 return RV_OK; | |
87 } | |
88 | |
89 | |
90 /****************************************************************************** | |
91 * Function : ffs_set_info | |
92 * | |
93 * Description : This function is called by the RV manager to inform | |
94 * the driver SWE about task_id, mb_id and error function. | |
95 * | |
96 * Parameters : - T_RVF_ADDR_ID addr_id: unique path to the SWE. | |
97 * - T_RV_RETURN ReturnPath[], array of return path for linked SWE | |
98 * - T_RVF_MB_ID mbId[]: array of memory bank ids. | |
99 * - callback function to call in case of unrecoverable error. | |
100 * | |
101 * Return : T_RVM_RETURN | |
102 * | |
103 * History : 0.1 (20-August-2000) | |
104 * | |
105 * | |
106 ******************************************************************************/ | |
107 T_RVM_RETURN ffs_set_info(T_RVF_ADDR_ID addr_id, | |
108 T_RV_RETURN ReturnPath[], | |
109 T_RVF_MB_ID mbId[], | |
110 T_RVM_RETURN (*callBackFct)(T_RVM_NAME SWEntName, | |
111 T_RVM_RETURN errorCause, | |
112 T_RVM_ERROR_TYPE errorType, | |
113 T_RVM_STRING errorMsg)) | |
114 { | |
115 /* store the pointer to the error function */ | |
116 ffs_error_ft = callBackFct ; | |
117 | |
118 ffs_task_init(mbId[0], addr_id); | |
119 | |
120 ffs_task_info.addr_id = addr_id; | |
121 ffs_task_info.mbid = mbId[0]; | |
122 | |
123 return RV_OK; | |
124 } | |
125 | |
126 | |
127 /****************************************************************************** | |
128 * Function : ffs_init | |
129 * | |
130 * Description : This function is called by the RV manager to initialize the | |
131 * ffs SWE before creating the task and calling ffs_start. | |
132 * | |
133 * Parameters : None | |
134 * | |
135 * Return : T_RVM_RETURN | |
136 * | |
137 * History : 0.1 (20-August-2000) | |
138 * | |
139 * | |
140 ******************************************************************************/ | |
141 T_RVM_RETURN ffs_init(void) | |
142 { | |
143 return RV_OK; | |
144 } | |
145 | |
146 | |
147 /****************************************************************************** | |
148 * Function : ffs_start | |
149 * | |
150 * Description : This function is called by the RV manager to start the ffs | |
151 * SWE, it is the body of the task. | |
152 * | |
153 * Parameters : None | |
154 * | |
155 * Return : T_RVM_RETURN | |
156 * | |
157 * History : 0.1 (20-August-2000) | |
158 * | |
159 * | |
160 ******************************************************************************/ | |
161 T_RVM_RETURN ffs_start(void) | |
162 { | |
163 ffs_task(); | |
164 return RV_OK; | |
165 } | |
166 | |
167 | |
168 /****************************************************************************** | |
169 * Function : ffs_stop | |
170 * | |
171 * Description : This function is called by the RV manager to stop the ffs SWE. | |
172 * | |
173 * Parameters : None | |
174 * | |
175 * Return : T_RVM_RETURN | |
176 * | |
177 * History : 0.1 (20-August-2000) | |
178 * | |
179 * | |
180 ******************************************************************************/ | |
181 T_RVM_RETURN ffs_stop(void) | |
182 { | |
183 /* other SWEs have not been killed yet, ffs can send messages to other SWEs */ | |
184 | |
185 return RV_OK; | |
186 } | |
187 | |
188 | |
189 /****************************************************************************** | |
190 * Function : ffs_kill | |
191 * | |
192 * Description : This function is called by the RV manager to kill the ffs | |
193 * SWE, after the ffs_stop function has been called. | |
194 * | |
195 * Parameters : None | |
196 * | |
197 * Return : T_RVM_RETURN | |
198 * | |
199 * History : 0.1 (20-August-2000) | |
200 * | |
201 * | |
202 ******************************************************************************/ | |
203 T_RVM_RETURN ffs_kill (void) | |
204 { | |
205 /* free all memory buffer previously allocated */ | |
206 return RV_OK; | |
207 } |