comparison chipsetsw/services/lls/lls_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 * @file lls_env.c
3 *
4 * Coding of the Riviera Generic Functions
5 *
6 * @author Laurent Sollier (l-sollier@ti.com)
7 * @version 0.1
8 */
9
10 /*
11 * History:
12 *
13 * Date Author Modification
14 * ----------------------------------------
15 * 03/12/2002 L Sollier Create
16 *
17 *
18 * (C) Copyright 2002 by Texas Instruments Incorporated, All Rights Reserved
19 */
20
21 #include "lls/lls_env.h"
22 #include "lls/lls_i.h"
23
24 #include "rvm/rvm_use_id_list.h"
25
26 #include <string.h>
27
28
29 /**
30 * Pointer on the structure gathering all the global variables
31 * used by LLS instance.
32 */
33 T_LLS_ENV_CTRL_BLK* lls_env_ctrl_blk = NULL;
34
35
36 /**
37 * @name Riviera generic functions implementation
38 *
39 */
40 /*@{*/
41
42 /**
43 * function: lls_get_info
44 */
45 T_RVM_RETURN lls_get_info(T_RVM_INFO_SWE* swe_info)
46 {
47 /* SWE info */
48 swe_info->swe_type = RVM_SWE_TYPE_1;
49 swe_info->type_info.type1.swe_use_id = LLS_USE_ID;
50
51 memcpy( swe_info->type_info.type1.swe_name, "LLS", sizeof("LLS") );
52
53 /* Set the return path */
54 swe_info->type_info.type1.return_path.callback_func = NULL;
55 swe_info->type_info.type1.return_path.addr_id = 0;
56
57
58 /* memory bank info */
59 swe_info->type_info.type1.nb_mem_bank = 1;
60
61 memcpy ((UINT8 *) swe_info->type_info.type1.mem_bank[0].bank_name, "LLS_PRIM", 9);
62 swe_info->type_info.type1.mem_bank[0].initial_params.size = LLS_MB_PRIM_SIZE;
63 swe_info->type_info.type1.mem_bank[0].initial_params.watermark = LLS_MB_PRIM_WATERMARK;
64
65 /* linked SWE info */
66 /* this SWE does not require any SWE to run */
67 swe_info->type_info.type1.nb_linked_swe = 1;
68 swe_info->type_info.type1.linked_swe_id[0] = SPI_USE_ID;
69
70 /* generic functions */
71 swe_info->type_info.type1.set_info = lls_set_info;
72 swe_info->type_info.type1.init = lls_init;
73 swe_info->type_info.type1.start = lls_start;
74 swe_info->type_info.type1.stop = lls_stop;
75 swe_info->type_info.type1.kill = lls_kill;
76
77 return RVM_OK;
78 }
79
80
81 /**
82 * function: lls_set_info
83 */
84 T_RVM_RETURN lls_set_info (T_RVF_ADDR_ID addr_id,
85 T_RV_RETURN return_path[],
86 T_RVF_MB_ID bk_id[],
87 T_RVM_RETURN (*rvm_error_ft)(T_RVM_NAME swe_name,
88 T_RVM_RETURN error_cause,
89 T_RVM_ERROR_TYPE error_type,
90 T_RVM_STRING error_msg))
91 {
92 /* Create instance gathering all the variable used by LLS instance */
93 if (rvf_get_buf(bk_id[0],
94 sizeof(T_LLS_ENV_CTRL_BLK),
95 (T_RVF_BUFFER**)&lls_env_ctrl_blk) != RVF_GREEN)
96 {
97 /* The environemnt will cancel the LLS instance creation. */
98 return RVM_MEMORY_ERR;
99 }
100
101 /* Store the pointer to the error function */
102 lls_env_ctrl_blk->error_ft = rvm_error_ft ;
103 /* Store the mem bank id. */
104 lls_env_ctrl_blk->prim_id = bk_id[0];
105 lls_env_ctrl_blk->swe_is_initialized = FALSE;
106
107 /* return_path of linked SWE -> not used */
108 return RVM_OK;
109 }
110
111
112 /**
113 * function: lls_init
114 */
115 T_RVM_RETURN lls_init(void)
116 {
117 if (lls_env_ctrl_blk != 0)
118 lls_env_ctrl_blk->swe_is_initialized = TRUE;
119 else
120 return RV_INTERNAL_ERR;
121
122 if (lls_initialize() != RV_OK)
123 return RV_INTERNAL_ERR;
124
125 return RV_OK;
126 }
127
128
129 /**
130 * function: lls_start
131 */
132 T_RVM_RETURN lls_start(void)
133 {
134 return RV_OK;
135 }
136
137
138 /**
139 * function: lls_stop
140 */
141 T_RVM_RETURN lls_stop(void)
142 {
143
144 return RVM_OK;
145 }
146
147
148 /**
149 * function: lls_kill
150 */
151 T_RVM_RETURN lls_kill (void)
152 {
153 /*
154 * DO NOT SEND MESSAGES
155 */
156 rvf_free_buf(lls_env_ctrl_blk);
157
158 lls_kill_service();
159
160 return RVM_OK;
161 }
162
163
164 /*@}*/