1 |
kusanagi |
1.1 |
/**************************************************************************** |
2 |
|
|
/* F i l e D a t a |
3 |
|
|
/* |
4 |
|
|
/* Module : MCMDManager |
5 |
|
|
/* C.I. No. : |
6 |
|
|
/* $Revision: 1.5 $ |
7 |
|
|
/* $Date: 2005/02/21 08:58:29 $ |
8 |
|
|
/* Belonging to : |
9 |
|
|
/* : |
10 |
|
|
/* $RCSfile: MD_MCMDDispatcher_op.c,v $ |
11 |
|
|
/* Program Type : |
12 |
|
|
/* Sub-modules : |
13 |
|
|
/* |
14 |
|
|
/**************************************************************************** |
15 |
|
|
/* S W D e v e l o p m e n t E n v i r o n m e n t |
16 |
|
|
/* |
17 |
|
|
/* Host system : |
18 |
|
|
/* SW Compiler : |
19 |
|
|
/* $Author: sebastiani $ |
20 |
|
|
/* : |
21 |
|
|
/**************************************************************************** |
22 |
|
|
/* U p d a t i n g |
23 |
|
|
/* |
24 |
|
|
/* $Log: MD_MCMDDispatcher_op.c,v $ |
25 |
|
|
/* Revision 1.5 2005/02/21 08:58:29 sebastiani |
26 |
|
|
/* all log comments completed |
27 |
|
|
/* |
28 |
|
|
/* Revision 1.4 2004/09/17 15:01:00 faber |
29 |
|
|
/* LU_INFN_LOG flags fixing |
30 |
|
|
/* |
31 |
|
|
/* Revision 1.3 2004/05/10 12:59:17 faber |
32 |
|
|
/* __FILEID__ right value fixed: many .c files had the wrong value! |
33 |
|
|
/* |
34 |
|
|
/* Revision 1.2 2003/10/21 16:09:12 alfarano |
35 |
|
|
/* LU_LOG_INFN replacement for all remaining original log functions |
36 |
|
|
/* |
37 |
|
|
/* Revision 1.1.1.1 2003/08/04 09:40:21 sebastiani |
38 |
|
|
/* Imported sources laben rel. 19.06.2003 integrated with pam2 |
39 |
|
|
/* |
40 |
|
|
/* Revision 1.3 2002/05/09 08:16:34 zulia |
41 |
|
|
/* * acceptance release |
42 |
|
|
/* |
43 |
|
|
/* |
44 |
|
|
/*****************************************************************************/ |
45 |
|
|
|
46 |
|
|
/*============================= Include File ================================*/ |
47 |
|
|
|
48 |
|
|
#include <src/MCMDManager/MCMDDispatcher/MD_MCMDDispatcher_op.h> |
49 |
|
|
#include <src/MCMDManager/MCMDDispatcher/MD_MCMDDispatcher_int.h> |
50 |
|
|
|
51 |
|
|
#include <src/INFN/LU_SourceFileID_INFN.h> |
52 |
|
|
#define __FILEID__ _MD_MCMDDispatcher_op__c |
53 |
|
|
#include <src/INFN/PRH_ParamHandler_INFN.h> |
54 |
|
|
#include <src/INFN/LU_LogUtility_INFN.h> |
55 |
|
|
#include <src/INFN/PRH_ParamHandler_INFN_auto.h> |
56 |
|
|
LU_DECL_MASK(); |
57 |
|
|
|
58 |
|
|
/*======================== Object Internal variables ========================*/ |
59 |
|
|
|
60 |
|
|
|
61 |
|
|
/*****************************************************************************/ |
62 |
|
|
|
63 |
|
|
/*== M C M D i s p a t c h e r O P E R A T I O N A L F U N C T I O N S ==*/ |
64 |
|
|
|
65 |
|
|
/*****************************************************************************/ |
66 |
|
|
/* @Function: MD_opInitMCMDDispatcher */ |
67 |
|
|
/* @Purpose : */ |
68 |
|
|
/* The function initializes the MCMDDispatcher object. The OS directive */ |
69 |
|
|
/* are called to set priority and to ready the MCMDDispatcher task. */ |
70 |
|
|
/* */ |
71 |
|
|
/* @@ */ |
72 |
|
|
/* @Parameter Name @Mode @Description */ |
73 |
|
|
/* status_code OUT Return code */ |
74 |
|
|
/* @@ */ |
75 |
|
|
/*****************************************************************************/ |
76 |
|
|
|
77 |
|
|
status_code MD_opInitMCMDDispatcher (void) |
78 |
|
|
{ |
79 |
|
|
status_code status; |
80 |
|
|
unsigned int OldPriority; |
81 |
|
|
|
82 |
|
|
status =SUCCESSFUL; |
83 |
|
|
/* Task initialization */ |
84 |
|
|
if (OS_piTaskReady(MD_TASK,MD_tkMCMDDispatcher) != SUCCESSFUL) |
85 |
|
|
{ |
86 |
|
|
/*@LOG Task is not correctly started LOG_INFN HA_piLogHistoryEntry10(HA_E10_SW_MD,HA_E10_TSK_READY_ERR,status); */ |
87 |
|
|
LU_INFN_LOG(LU_FATAL|LU_HA,LU_MASK(__FILEID__),__FILEID__,__LINE__,status); |
88 |
|
|
status =UNSATISFIED; |
89 |
|
|
} |
90 |
|
|
if (OS_piTaskPriority(MD_TASK,MCMDDISP_PRIORITY,&OldPriority) != SUCCESSFUL) |
91 |
|
|
{ |
92 |
|
|
/*@LOG Task priority is not correctly updated LOG_INFN HA_piLogHistoryEntry10(HA_E10_SW_MD,HA_E10_TSK_PRIORITY_ERR,status); */ |
93 |
|
|
LU_INFN_LOG(LU_FATAL|LU_HA,LU_MASK(__FILEID__),__FILEID__,__LINE__,status); |
94 |
|
|
status =UNSATISFIED; |
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
return (status); |
98 |
|
|
|
99 |
|
|
} |
100 |
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
/*****************************************************************************/ |
104 |
|
|
/* @Function: MD_opSndMsgMCMDDispatcher */ |
105 |
|
|
/* @Purpose : */ |
106 |
|
|
/* The function invokes the directive of the OS to send a message to the */ |
107 |
|
|
/* MCMDDispatcher mailbox. */ |
108 |
|
|
/* */ |
109 |
|
|
/* @@ */ |
110 |
|
|
/* @Parameter Name @Mode @Description */ |
111 |
|
|
/* SndMsg IN Message buffer that contains task operation */ |
112 |
|
|
/* status_code OUT Return code */ |
113 |
|
|
/* @@ */ |
114 |
|
|
/*****************************************************************************/ |
115 |
|
|
|
116 |
|
|
status_code MD_opSndMsgMCMDDispatcher(MsgTsk* SndMsg) |
117 |
|
|
{ |
118 |
|
|
status_code status; |
119 |
|
|
|
120 |
|
|
/* Send message to MCMDDispatcher task mailbox */ |
121 |
|
|
status =OS_piMsgQueueSend(MD_MAILBOX,(void*)SndMsg,sizeof(MsgTsk)); |
122 |
|
|
if (status != SUCCESSFUL) |
123 |
|
|
{ |
124 |
|
|
/*@LOG Fail during the send message to MCMDDispatcher mailbox LOG_INFN HA_piLogHistoryEntry10(HA_E10_SW_MD,HA_E10_SEND_MSG_ERR,status); */ |
125 |
|
|
LU_INFN_LOG(LU_FATAL|LU_HA,LU_MASK(__FILEID__),__FILEID__,__LINE__,status); |
126 |
|
|
} |
127 |
|
|
return (status); |
128 |
|
|
|
129 |
|
|
} |
130 |
|
|
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
/*****************************************************************************/ |
134 |
|
|
/* @Function: MD_tkMCMDDispatcher */ |
135 |
|
|
/* @Purpose : */ |
136 |
|
|
/* The function is the task handler of the MCMDDispatcher object. */ |
137 |
|
|
/* When a message is received into task mailbox it wakes up. */ |
138 |
|
|
/* The information contained in the message (MsgTsk structure) define */ |
139 |
|
|
/* parameters (Info field), and the operation type that the task performs */ |
140 |
|
|
/* (Code field). */ |
141 |
|
|
/* The MCMDDispatcher task activity is to dispatch MCMD to the proper */ |
142 |
|
|
/* MCMD executors. */ |
143 |
|
|
/* */ |
144 |
|
|
/* @@ */ |
145 |
|
|
/* @Parameter Name @Mode @Description */ |
146 |
|
|
/* @@ */ |
147 |
|
|
/*****************************************************************************/ |
148 |
|
|
|
149 |
|
|
task MD_tkMCMDDispatcher (task_argument unused) |
150 |
|
|
{ |
151 |
|
|
MsgTsk RxMsg; |
152 |
|
|
status_code status; |
153 |
|
|
unsigned int MsgSize; |
154 |
|
|
|
155 |
|
|
|
156 |
|
|
while( FOREVER ) |
157 |
|
|
{ |
158 |
|
|
RxMsg.Code =NULL_MSG_MD; |
159 |
|
|
/* Wait for a message to become available */ |
160 |
|
|
if ((status =OS_piMsgQueueReceive (MD_MAILBOX,(void*)&RxMsg, |
161 |
|
|
&MsgSize,WAIT, NO_TIMEOUT)) == SUCCESSFUL) |
162 |
|
|
{ |
163 |
|
|
switch (RxMsg.Code) |
164 |
|
|
{ |
165 |
|
|
case MD_MCMD_EXEC: |
166 |
|
|
/* Dispatch the MCDM to the object executor */ |
167 |
|
|
MD_ifDispatch((MA_HEADER_MCMD* )RxMsg.Info); |
168 |
|
|
break; |
169 |
|
|
default: |
170 |
|
|
break; |
171 |
|
|
} |
172 |
|
|
} |
173 |
|
|
} |
174 |
|
|
} |
175 |
|
|
|
176 |
|
|
|