blob: 9976969a1647413ff6f004729cb6a2a0b2bd06ef [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001/*****************************************************************************
2* Copyright Statement:
3* --------------------
4* This software is protected by Copyright and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2005
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*****************************************************************************/
35
36/*****************************************************************************
37 *
38 * Filename:
39 * ---------
40 * sm_statemachine.h
41 *
42 * Project:
43 * --------
44 * Maui
45 *
46 * Description:
47 * ------------
48 * Header file for framework state machine
49 *
50 * Author:
51 * -------
52 * -------
53 *
54 *============================================================================
55 * HISTORY
56 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
57 *------------------------------------------------------------------------------
58 * removed!
59 * removed!
60 * removed!
61 *
62 * removed!
63 * removed!
64 * removed!
65 *
66 * removed!
67 * removed!
68 * removed!
69 * removed!
70 * removed!
71 * removed!
72 * removed!
73 *
74 * removed!
75 * removed!
76 * removed!
77 *
78 * removed!
79 * removed!
80 * removed!
81 *
82 * removed!
83 * removed!
84 * removed!
85 *
86 * removed!
87 * removed!
88 * removed!
89 *
90 * removed!
91 * removed!
92 * removed!
93 *
94 * removed!
95 * removed!
96 * removed!
97 * removed!
98 *
99 * removed!
100 * removed!
101 * removed!
102 *
103 * removed!
104 * removed!
105 * removed!
106 *
107 * removed!
108 * removed!
109 * removed!
110 *
111 * removed!
112 * removed!
113 * removed!
114 *
115 * removed!
116 * removed!
117 * removed!
118 *
119 * removed!
120 * removed!
121 * removed!
122 *
123 * removed!
124 * removed!
125 * removed!
126 *
127 * removed!
128 * removed!
129 * removed!
130 *
131 * removed!
132 * removed!
133 * removed!
134 *
135 * removed!
136 * removed!
137 * removed!
138 *
139 * removed!
140 * removed!
141 * removed!
142 *
143 * removed!
144 * removed!
145 * removed!
146 *------------------------------------------------------------------------------
147 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
148 *============================================================================
149 ****************************************************************************/
150
151#ifndef __SM_STATEMACHINE_H__
152#define __SM_STATEMACHINE_H__
153
154/* INCLUDES ***********************************************************************/
155
156#include "sm_type.h"
157#include "kal_public_api.h" //MSBB change #include "stack_ltlcom.h"
158#include "kal_general_types.h"
159
160/* MACROS *************************************************************************/
161
162/* ---------------------------------------------------------------------------------
163start and terminate states
164--------------------------------------------------------------------------------- */
165
166#define SM_START 0x0000
167#define SM_TERMINATE 0xffff
168
169/* ---------------------------------------------------------------------------------
170transition function signature
171--------------------------------------------------------------------------------- */
172
173#define mSM_TRANSITION_FN(x) \
174 kal_bool x(ilm_struct* tReceivedMsg, \
175 kal_uint32 U32InterpretedEvent, \
176 kal_uint32* pU32State, \
177 struct tContext* ptContext, \
178 kal_bool* pSaved, \
179 kal_bool* pReleaseMsg, \
180 kal_bool isSavedEvent)
181
182/* ---------------------------------------------------------------------------------
183message translation function signature
184--------------------------------------------------------------------------------- */
185
186#define mSM_TRANSLATE_MSG_FN(x) \
187 kal_bool x(ilm_struct* ptReceivedMsg, \
188 kal_uint32* pU32InterpretedEvent, \
189 kal_uint32* pU32TableIndex, \
190 kal_uint32* pInstanceIndex, \
191 struct tContext* ptContext)
192
193/* PUBLIC FUNCTION DECLARATION ****************************************************/
194
195extern mSM_TRANSITION_FN(eSM_IgnoreEvent) ;
196
197extern mSM_TRANSITION_FN(eSM_WarningEvent) ;
198
199extern mSM_TRANSITION_FN(eSM_InvalidEvent) ;
200
201extern mSM_TRANSITION_FN(eSM_SavedEvent) ;
202
203extern kal_bool eSM_EventLookup(const tTranslateTableEntry *ptTable,
204 kal_uint32 U32Entries,
205 ilm_struct *ptMessage,
206 kal_uint32 *pU32Event,
207 kal_uint32 *pU32TableIndex,
208 kal_uint32 *pInstanceIndex) ;
209
210extern void eSM_ExecuteContext(struct tContext *ptContext, ilm_struct *tReceivedMsg) ;
211
212extern void eSM_InitContext(struct tContext *FirstContext) ;
213
214extern void eSM_ResetFSM(struct tContext *ptContext, kal_bool Exec_Process_Entry);
215
216extern void eSM_PopulateProcessServiceSM(tStateMachine *pSM,
217 kal_uint32 processId,
218 kal_uint32 numStates,
219 kal_uint32 numEvents,
220 const tTableEntry *pStateTable,
221 const kal_int8 *serviceName);
222
223extern kal_uint32 eSM_GetInstanceCurrentState(tComponentInfo *ptCompInfo, kal_uint32 processID, kal_uint32 instanceID);
224
225extern kal_bool fSM_LookUpSpecificSavedEvent(tInstanceEntry *pInstance, kal_uint32 eventId, ilm_struct *pMsg);
226
227extern kal_bool fSM_DeleteSpecificSavedEvent(tInstanceEntry *pInstance, kal_uint32 eventId);
228
229extern kal_bool fSM_ClearSavedEventQueue(tInstanceEntry *pInstance);
230
231// 20120925 Scotty R9_MultiMode__FSM_extern
232extern void fSM_HandleSavedEvents(struct tContext *pContext, tInstanceEntry *pInstance);
233
234
235#endif /* __SM_STATEMACHINE_H__ */