FreeCalypso > hg > tcs211-fcmodem
comparison chipsetsw/services/mks/mks_api.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 mks_api.c | |
3 * | |
4 * Implementation of bridge 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/19/2001 L Sollier Create | |
16 * | |
17 * | |
18 * (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved | |
19 */ | |
20 | |
21 #include "mks/mks_api.h" | |
22 #include "mks/mks_env.h" | |
23 #include "mks/mks_i.h" | |
24 #include "mks/mks_messages_i.h" | |
25 | |
26 #include "rvm/rvm_use_id_list.h" | |
27 | |
28 #include <string.h> | |
29 | |
30 /** External declaration */ | |
31 extern T_MKS_ENV_CTRL_BLK* mks_env_ctrl_blk; | |
32 | |
33 | |
34 | |
35 /** | |
36 * @name Bridge functions implementation | |
37 * | |
38 */ | |
39 /*@{*/ | |
40 | |
41 | |
42 /** | |
43 * function: mks_add_key_sequence | |
44 */ | |
45 T_RV_RET mks_add_key_sequence(T_MKS_INFOS_KEY_SEQUENCE* infos_key_sequence_p) | |
46 { | |
47 T_RV_RET ret = RV_INVALID_PARAMETER; | |
48 T_MKS_INFOS_KEY_SEQUENCE_MSG* msg_p; | |
49 T_RVF_MB_STATUS mb_status; | |
50 | |
51 /* Test validity of structure */ | |
52 if ((infos_key_sequence_p->nb_key_of_sequence >=3) && (infos_key_sequence_p->nb_key_of_sequence <= MKS_NB_MAX_OF_KEY_IN_KEY_SEQUENCE)) | |
53 { | |
54 if ( (infos_key_sequence_p->completion_type == MKS_SEQUENCE_COMPLETED) | |
55 || ( (infos_key_sequence_p->completion_type == MKS_POST_SEQUENCE) | |
56 && (infos_key_sequence_p->nb_key_for_post_sequence > 0) | |
57 && (infos_key_sequence_p->nb_key_for_post_sequence <= MKS_NB_MAX_OF_KEY_FOR_POST_SEQUENCE)) ) | |
58 { | |
59 /* Reserve memory for message */ | |
60 mb_status = rvf_get_buf (mks_env_ctrl_blk->prim_id, sizeof(T_MKS_INFOS_KEY_SEQUENCE_MSG), (void **) &msg_p); | |
61 | |
62 if (mb_status != RVF_RED) /* Memory allocation success */ | |
63 { | |
64 /* Fill the message */ | |
65 msg_p->hdr.msg_id = MKS_INFOS_KEY_SEQUENCE_MSG; | |
66 | |
67 msg_p->key_sequence_infos = *infos_key_sequence_p; | |
68 | |
69 /* Send message to the MKS task */ | |
70 rvf_send_msg(mks_env_ctrl_blk->addr_id, msg_p); | |
71 | |
72 ret = RV_OK; | |
73 } | |
74 else | |
75 { | |
76 MKS_SEND_TRACE("MKS: Memory allocation error", RV_TRACE_LEVEL_ERROR); | |
77 ret = RV_MEMORY_ERR; | |
78 } | |
79 } | |
80 } | |
81 | |
82 return ret; | |
83 } | |
84 | |
85 /** | |
86 * function: mks_remove_key_sequence | |
87 * | |
88 */ | |
89 T_RV_RET mks_remove_key_sequence(char name[KPD_MAX_CHAR_NAME+1]) | |
90 { | |
91 T_MKS_REMOVE_KEY_SEQUENCE_MSG* msg_p; | |
92 T_RVF_MB_STATUS mb_status; | |
93 T_RV_RET ret = RV_OK; | |
94 | |
95 /* Reserve memory for message */ | |
96 mb_status = rvf_get_buf (mks_env_ctrl_blk->prim_id, sizeof(T_MKS_REMOVE_KEY_SEQUENCE_MSG), (void **) &msg_p); | |
97 | |
98 if (mb_status != RVF_RED) /* Memory allocation success */ | |
99 { | |
100 /* Fill the message */ | |
101 msg_p->hdr.msg_id = MKS_REMOVE_KEY_SEQUENCE_MSG; | |
102 | |
103 memcpy(msg_p->name, name, KPD_MAX_CHAR_NAME+1); | |
104 | |
105 /* Send message to the MKS task */ | |
106 rvf_send_msg(mks_env_ctrl_blk->addr_id, msg_p); | |
107 | |
108 ret = RV_OK; | |
109 } | |
110 else | |
111 { | |
112 MKS_SEND_TRACE("MKS: Memory allocation error", RV_TRACE_LEVEL_ERROR); | |
113 ret = RV_MEMORY_ERR; | |
114 } | |
115 | |
116 | |
117 return ret; | |
118 } | |
119 | |
120 | |
121 /*@}*/ |