comparison gsm-fw/services/ffs/ffs_env.c @ 213:ef7d7da61c56

FFS code integration: remaining C files imported, but not yet integrated
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 06 Jan 2014 04:20:29 +0000
parents
children bdfdea886bea
comparison
equal deleted inserted replaced
212:3ebe6409e8bc 213:ef7d7da61c56
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 "board.cfg"
20 #include "ffs.cfg"
21 #include "ffs/ffs_env.h"
22 #include "rvm/rvm_gen.h"
23 #include "rvm/rvm_priorities.h"
24 #include "rvm/rvm_use_id_list.h"
25 #include "ffs/board/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, T_RVM_RETURN error_cause,
33 T_RVM_ERROR_TYPE error_type,T_RVM_STRING error_msg);
34
35 /******************************************************************************
36 * Function : ffs_get_info
37 *
38 * Description : This function is called by the RV manager to learn
39 * driver requirements in terms of memory, SWEs...
40 *
41 * Parameters : T_RVM_INFO_SWE * swe_info: pointer to the structure to fill
42 * containing infos related to the driver SWE.
43 *
44 * Return : T_RVM_RETURN
45 *
46 * History : 0.1 (20-August-2000)
47 *
48 *
49 ******************************************************************************/
50 T_RVM_RETURN ffs_get_info(T_RVM_INFO_SWE * infoSWE)
51 {
52
53 /* SWE info */
54 infoSWE->swe_type = RVM_SWE_TYPE_4;
55
56 infoSWE->type_info.type4.swe_use_id = FFS_USE_ID;
57 memcpy ( (UINT8 *) infoSWE->type_info.type4.swe_name, "FFS", sizeof("FFS") );
58 infoSWE->type_info.type4.version = 0;
59
60 infoSWE->type_info.type4.stack_size = FFS_STACK_SIZE;
61 infoSWE->type_info.type4.priority = RVM_FFS_TASK_PRIORITY;
62
63 /* memory bank info */
64 infoSWE->type_info.type4.nb_mem_bank = 1;
65
66 memcpy ((UINT8 *) infoSWE->type_info.type4.mem_bank[0].bank_name, "FFS_PRIM", RVM_NAME_MAX_LEN);
67 infoSWE->type_info.type4.mem_bank[0].initial_params.size = FFS_MB_PRIM_SIZE;
68 infoSWE->type_info.type4.mem_bank[0].initial_params.watermark = FFS_MB_PRIM_WATERMARK;
69
70 /* linked SWE info */
71 infoSWE->type_info.type4.nb_linked_swe = 0;
72
73 /* generic functions */
74 infoSWE->type_info.type4.set_info = ffs_set_info;
75 infoSWE->type_info.type4.init = ffs_init;
76 infoSWE->type_info.type4.core = ffs_start;
77 infoSWE->type_info.type4.stop = ffs_stop;
78 infoSWE->type_info.type4.kill = ffs_kill;
79
80 /* Set return_path */
81 infoSWE->type_info.type4.return_path.callback_func = NULL;
82 infoSWE->type_info.type4.return_path.addr_id = 0;
83
84 return RV_OK;
85 }
86
87
88 /******************************************************************************
89 * Function : ffs_set_info
90 *
91 * Description : This function is called by the RV manager to inform
92 * the driver SWE about task_id, mb_id and error function.
93 *
94 * Parameters : - T_RVF_ADDR_ID addr_id: unique path to the SWE.
95 * - T_RV_RETURN ReturnPath[], array of return path for linked SWE
96 * - T_RVF_MB_ID mbId[]: array of memory bank ids.
97 * - callback function to call in case of unrecoverable error.
98 *
99 * Return : T_RVM_RETURN
100 *
101 * History : 0.1 (20-August-2000)
102 *
103 *
104 ******************************************************************************/
105 T_RVM_RETURN ffs_set_info(T_RVF_ADDR_ID addr_id,
106 T_RV_RETURN ReturnPath[],
107 T_RVF_MB_ID mbId[],
108 T_RVM_RETURN (*callBackFct)(T_RVM_NAME SWEntName,
109 T_RVM_RETURN errorCause,
110 T_RVM_ERROR_TYPE errorType,
111 T_RVM_STRING errorMsg))
112 {
113 /* store the pointer to the error function */
114 ffs_error_ft = callBackFct ;
115
116 ffs_task_init(mbId[0], addr_id);
117
118 ffs_task_info.addr_id = addr_id;
119 ffs_task_info.mbid = mbId[0];
120
121 return RV_OK;
122 }
123
124
125 /******************************************************************************
126 * Function : ffs_init
127 *
128 * Description : This function is called by the RV manager to initialize the
129 * ffs SWE before creating the task and calling ffs_start.
130 *
131 * Parameters : None
132 *
133 * Return : T_RVM_RETURN
134 *
135 * History : 0.1 (20-August-2000)
136 *
137 *
138 ******************************************************************************/
139 T_RVM_RETURN ffs_init(void)
140 {
141 return RV_OK;
142 }
143
144
145 /******************************************************************************
146 * Function : ffs_start
147 *
148 * Description : This function is called by the RV manager to start the ffs
149 * SWE, it is the body of the task.
150 *
151 * Parameters : None
152 *
153 * Return : T_RVM_RETURN
154 *
155 * History : 0.1 (20-August-2000)
156 *
157 *
158 ******************************************************************************/
159 T_RVM_RETURN ffs_start(void)
160 {
161 ffs_task();
162 return RV_OK;
163 }
164
165
166 /******************************************************************************
167 * Function : ffs_stop
168 *
169 * Description : This function is called by the RV manager to stop the ffs SWE.
170 *
171 * Parameters : None
172 *
173 * Return : T_RVM_RETURN
174 *
175 * History : 0.1 (20-August-2000)
176 *
177 *
178 ******************************************************************************/
179 T_RVM_RETURN ffs_stop(void)
180 {
181 /* other SWEs have not been killed yet, ffs can send messages to other SWEs */
182
183 return RV_OK;
184 }
185
186
187 /******************************************************************************
188 * Function : ffs_kill
189 *
190 * Description : This function is called by the RV manager to kill the ffs
191 * SWE, after the ffs_stop function has been called.
192 *
193 * Parameters : None
194 *
195 * Return : T_RVM_RETURN
196 *
197 * History : 0.1 (20-August-2000)
198 *
199 *
200 ******************************************************************************/
201 T_RVM_RETURN ffs_kill (void)
202 {
203 /* free all memory buffer previously allocated */
204 return RV_OK;
205 }