comparison src/cs/drivers/drv_app/spi/spi_env.c @ 260:34b7059b9337

drv_app/spi/*: code readability fixes
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 14 May 2021 02:13:47 +0000
parents 365833d1d186
children 841a848ba762
comparison
equal deleted inserted replaced
259:365833d1d186 260:34b7059b9337
33 33
34 /* Global variables */ 34 /* Global variables */
35 T_SPI_GBL_INFO *SPI_GBL_INFO_PTR = NULL; 35 T_SPI_GBL_INFO *SPI_GBL_INFO_PTR = NULL;
36 36
37 37
38 38 /******************************************************************************
39 /****************************************************************************** 39 * Function : spi_get_info
40 * Function : spi_get_info
41 * 40 *
42 * Description : This function is called by the RV manager to learn 41 * Description : This function is called by the RV manager to learn
43 * spi requirements in terms of memory, SWEs... 42 * spi requirements in terms of memory, SWEs...
44 * 43 *
45 * Parameters : T_RVM_INFO_SWE * swe_info: pointer to the structure to fill 44 * Parameters : T_RVM_INFO_SWE * swe_info: pointer to the structure to fill
51 * 50 *
52 * 51 *
53 ******************************************************************************/ 52 ******************************************************************************/
54 T_RVM_RETURN spi_get_info(T_RVM_INFO_SWE * infoSWE) 53 T_RVM_RETURN spi_get_info(T_RVM_INFO_SWE * infoSWE)
55 { 54 {
56
57 /* SWE info */ 55 /* SWE info */
58 56
59 infoSWE->swe_type = RVM_SWE_TYPE_4; 57 infoSWE->swe_type = RVM_SWE_TYPE_4;
60 infoSWE->type_info.type4.swe_use_id = SPI_USE_ID; 58 infoSWE->type_info.type4.swe_use_id = SPI_USE_ID;
61 memcpy( infoSWE->type_info.type4.swe_name, "SPI", sizeof("SPI") ); 59 memcpy( infoSWE->type_info.type4.swe_name, "SPI", sizeof("SPI") );
62 60
63 infoSWE->type_info.type4.stack_size = SPI_STACK_SIZE; 61 infoSWE->type_info.type4.stack_size = SPI_STACK_SIZE;
64 infoSWE->type_info.type4.priority = RVM_SPI_TASK_PRIORITY; 62 infoSWE->type_info.type4.priority = RVM_SPI_TASK_PRIORITY;
65 63
66
67 /* memory bank info */ 64 /* memory bank info */
68 infoSWE->type_info.type4.nb_mem_bank = 1; 65 infoSWE->type_info.type4.nb_mem_bank = 1;
69 66
70 memcpy ((UINT8 *) infoSWE->type_info.type4.mem_bank[0].bank_name, "SPI_PRIM", 9); 67 memcpy ((UINT8 *) infoSWE->type_info.type4.mem_bank[0].bank_name, "SPI_PRIM", 9);
71 infoSWE->type_info.type4.mem_bank[0].initial_params.size = SPI_MB_PRIM_SIZE; 68 infoSWE->type_info.type4.mem_bank[0].initial_params.size = SPI_MB_PRIM_SIZE;
72 infoSWE->type_info.type4.mem_bank[0].initial_params.watermark = SPI_MB_PRIM_WATERMARK; 69 infoSWE->type_info.type4.mem_bank[0].initial_params.watermark = SPI_MB_PRIM_WATERMARK;
73 70
74
75 /* linked SWE info */ 71 /* linked SWE info */
76 infoSWE->type_info.type4.nb_linked_swe = 0; 72 infoSWE->type_info.type4.nb_linked_swe = 0;
77
78 73
79 /* generic functions */ 74 /* generic functions */
80 infoSWE->type_info.type4.set_info = spi_set_info; 75 infoSWE->type_info.type4.set_info = spi_set_info;
81 infoSWE->type_info.type4.init = spi_init; 76 infoSWE->type_info.type4.init = spi_init;
82 infoSWE->type_info.type4.core = spi_core; 77 infoSWE->type_info.type4.core = spi_core;
90 return RV_OK; 85 return RV_OK;
91 } 86 }
92 87
93 88
94 /****************************************************************************** 89 /******************************************************************************
95 * Function : spi_set_info 90 * Function : spi_set_info
96 * 91 *
97 * Description : This function is called by the RV manager to inform 92 * Description : This function is called by the RV manager to inform
98 * the spi SWE about task_id, mb_id and error function. 93 * the spi SWE about task_id, mb_id and error function.
99 * 94 *
100 * Parameters : - T_RVM_TASK_ID taskId: task_id. 95 * Parameters : - T_RVM_TASK_ID taskId: task_id.
134 SPI_USE_ID); 129 SPI_USE_ID);
135 130
136 return (RVM_MEMORY_ERR); 131 return (RVM_MEMORY_ERR);
137 } 132 }
138 133
139
140 /* store the pointer to the error function */ 134 /* store the pointer to the error function */
141 spi_error_ft = callBackFct ; 135 spi_error_ft = callBackFct ;
142 136
143 SPI_GBL_INFO_PTR->prim_id = mbId[0]; 137 SPI_GBL_INFO_PTR->prim_id = mbId[0];
144 138
160 return RV_OK; 154 return RV_OK;
161 } 155 }
162 156
163 157
164 /****************************************************************************** 158 /******************************************************************************
165 * Function : spi_init 159 * Function : spi_init
166 * 160 *
167 * Description : This function is called by the RV manager to initialize the 161 * Description : This function is called by the RV manager to initialize the
168 * spi SWE before creating the task and calling spi_start. 162 * spi SWE before creating the task and calling spi_start.
169 * 163 *
170 * Parameters : None 164 * Parameters : None
171 * 165 *
172 * Return : T_RVM_RETURN 166 * Return : T_RVM_RETURN
173 * 167 *
174 * History : 0.1 (20-August-2000) 168 * History : 0.1 (20-August-2000)
175 * 169 *
176 * 170 *
177 ******************************************************************************/ 171 ******************************************************************************/
178 T_RVM_RETURN spi_init(void) 172 T_RVM_RETURN spi_init(void)
179 { 173 {
180 174 return RV_OK;
181 return RV_OK; 175 }
182 } 176
183 177
184 178 /******************************************************************************
185 179 * Function : spi_stop
186 /******************************************************************************
187 * Function : spi_stop
188 * 180 *
189 * Description : This function is called by the RV manager to stop the spi SWE. 181 * Description : This function is called by the RV manager to stop the spi SWE.
190 * 182 *
191 * Parameters : None 183 * Parameters : None
192 * 184 *
193 * Return : T_RVM_RETURN 185 * Return : T_RVM_RETURN
194 * 186 *
195 * History : 0.1 (20-August-2000) 187 * History : 0.1 (20-August-2000)
196 * 188 *
197 * 189 *
198 ******************************************************************************/ 190 ******************************************************************************/
199 T_RVM_RETURN spi_stop(void) 191 T_RVM_RETURN spi_stop(void)
200 { 192 {
203 return RV_OK; 195 return RV_OK;
204 } 196 }
205 197
206 198
207 /****************************************************************************** 199 /******************************************************************************
208 * Function : spi_kill 200 * Function : spi_kill
209 * 201 *
210 * Description : This function is called by the RV manager to kill the spi 202 * Description : This function is called by the RV manager to kill the spi
211 * SWE, after the spi_stop function has been called. 203 * SWE, after the spi_stop function has been called.
212 * 204 *
213 * Parameters : None 205 * Parameters : None
221 T_RVM_RETURN spi_kill (void) 213 T_RVM_RETURN spi_kill (void)
222 { 214 {
223 /* free all memory buffer previously allocated */ 215 /* free all memory buffer previously allocated */
224 return RV_OK; 216 return RV_OK;
225 } 217 }
226
227
228