comparison src/cs/services/mks/mks_env.c @ 0:945cf7f506b2

src/cs: chipsetsw import from tcs211-fcmodem binary blobs and LCD demo files have been excluded, all line endings are LF only
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 25 Sep 2016 22:50:11 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:945cf7f506b2
1 /**
2 * @file mks_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 * 11/16/2001 L Sollier Create
16 *
17 *
18 * (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved
19 */
20
21 #include "mks/mks_env.h"
22 #include "mks/mks_i.h"
23
24 #include "rvm/rvm_use_id_list.h"
25 #include "rvm/rvm_priorities.h"
26
27 #include <string.h>
28
29
30 /* External declaration */
31 extern T_RV_RET mks_core(void);
32
33 /**
34 * Pointer on the structure gathering all the global variables
35 * used by MKS instance.
36 */
37 T_MKS_ENV_CTRL_BLK* mks_env_ctrl_blk = NULL;
38
39
40 /**
41 * @name Riviera generic functions implementation
42 *
43 */
44 /*@{*/
45
46 /**
47 * function: mks_get_info
48 */
49 T_RVM_RETURN mks_get_info(T_RVM_INFO_SWE* swe_info)
50 {
51 /* SWE info */
52 swe_info->swe_type = RVM_SWE_TYPE_4;
53 swe_info->type_info.type4.swe_use_id = MKS_USE_ID;
54
55 memcpy( swe_info->type_info.type4.swe_name, "MKS", sizeof("MKS") );
56
57 swe_info->type_info.type4.stack_size = MKS_STACK_SIZE;
58 swe_info->type_info.type4.priority = RVM_MKS_TASK_PRIORITY;
59
60
61 /* Set the return path */
62 swe_info->type_info.type4.return_path.callback_func = NULL;
63 swe_info->type_info.type4.return_path.addr_id = 0;
64
65
66 /* memory bank info */
67 swe_info->type_info.type4.nb_mem_bank = 1;
68
69 memcpy ((UINT8 *) swe_info->type_info.type4.mem_bank[0].bank_name, "MKS_PRIM", 9);
70 swe_info->type_info.type4.mem_bank[0].initial_params.size = MKS_MB_PRIM_SIZE;
71 swe_info->type_info.type4.mem_bank[0].initial_params.watermark = MKS_MB_PRIM_WATERMARK;
72
73 /* Linked SWE info */
74 swe_info->type_info.type4.linked_swe_id[0] = KPD_USE_ID;
75 swe_info->type_info.type4.nb_linked_swe = 1;
76
77 /* generic functions */
78 swe_info->type_info.type4.set_info = mks_set_info;
79 swe_info->type_info.type4.init = mks_init;
80 swe_info->type_info.type4.core = mks_core;
81 swe_info->type_info.type4.stop = mks_stop;
82 swe_info->type_info.type4.kill = mks_kill;
83
84 return RVM_OK;
85 }
86
87
88 /**
89 * function: mks_set_info
90 */
91 T_RVM_RETURN mks_set_info (T_RVF_ADDR_ID addr_id,
92 T_RV_RETURN return_path[],
93 T_RVF_MB_ID bk_id[],
94 T_RVM_RETURN (*rvm_error_ft)(T_RVM_NAME swe_name,
95 T_RVM_RETURN error_cause,
96 T_RVM_ERROR_TYPE error_type,
97 T_RVM_STRING error_msg))
98 {
99 /* Create instance gathering all the variable used by MKS instance */
100 if (rvf_get_buf(bk_id[0],
101 sizeof(T_MKS_ENV_CTRL_BLK),
102 (T_RVF_BUFFER**)&mks_env_ctrl_blk) != RVF_GREEN)
103 {
104 /* The environemnt will cancel the MKS instance creation. */
105 return RVM_MEMORY_ERR;
106 }
107
108 /* Store the pointer to the error function */
109 mks_env_ctrl_blk->error_ft = rvm_error_ft ;
110 /* Store the mem bank id. */
111 mks_env_ctrl_blk->prim_id = bk_id[0];
112 /* Store the address id */
113 mks_env_ctrl_blk->addr_id = addr_id;
114
115 /* return_path of linked SWE -> not used */
116 return RVM_OK;
117 }
118
119
120 /**
121 * function: mks_init
122 */
123 T_RVM_RETURN mks_init(void)
124 {
125 return RV_OK;
126 }
127
128
129 /**
130 * function: mks_stop
131 */
132 T_RVM_RETURN mks_stop(void)
133 {
134 /* Stop MKS SWE */
135 mks_stop_swe();
136
137 return RVM_OK;
138 }
139
140
141 /**
142 * function: mks_kill
143 */
144 T_RVM_RETURN mks_kill (void)
145 {
146 /*
147 * DO NOT SEND MESSAGES
148 */
149
150 rvf_free_buf(mks_env_ctrl_blk);
151
152 return RVM_OK;
153 }
154
155
156 /*@}*/