1 | /*
|
---|
2 | * TOPPERS/JSP Kernel
|
---|
3 | * Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
4 | * Just Standard Profile Kernel
|
---|
5 | *
|
---|
6 | * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
|
---|
7 | * Toyohashi Univ. of Technology, JAPAN
|
---|
8 | *
|
---|
9 | * ä¸è¨è使¨©è
|
---|
10 | ã¯ï¼ä»¥ä¸ã® (1)ã(4) ã®æ¡ä»¶ãï¼Free Software Foundation
|
---|
11 | * ã«ãã£ã¦å
|
---|
12 | ¬è¡¨ããã¦ãã GNU General Public License ã® Version 2 ã«è¨
|
---|
13 | * è¿°ããã¦ããæ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§ã¢ï¼æ¬ã½ããã¦ã§ã¢
|
---|
14 | * ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»åé
|
---|
15 | å¸ï¼ä»¥ä¸ï¼
|
---|
16 | * å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
17 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
18 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
19 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
20 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
21 | * ç¨ã§ããå½¢ã§åé
|
---|
22 | å¸ããå ´åã«ã¯ï¼åé
|
---|
23 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
24 | * è
|
---|
25 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è使¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
26 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
27 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
28 | * ç¨ã§ããªãå½¢ã§åé
|
---|
29 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
30 | * ã¨ï¼
|
---|
31 | * (a) åé
|
---|
32 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
33 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
34 | * 使¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
35 | * (b) åé
|
---|
36 | å¸ã®å½¢æ
|
---|
37 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
38 | * å ±åãããã¨ï¼
|
---|
39 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
40 | * 害ãããï¼ä¸è¨è使¨©è
|
---|
41 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
42 | 責ãããã¨ï¼
|
---|
43 | *
|
---|
44 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨è使¨©è
|
---|
45 | ã
|
---|
46 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ãã®é©ç¨å¯è½æ§ã
|
---|
47 | * å«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´
|
---|
48 | * æ¥çã¾ãã¯éæ¥çã«çãããããªãæå®³ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè² ããªãï¼
|
---|
49 | *
|
---|
50 | * @(#) $Id: kernellog.h,v 1.2 2003/12/20 09:19:59 takayuki Exp $
|
---|
51 | */
|
---|
52 |
|
---|
53 | // KernelLog.h : CKernelLog ã®å®£è¨
|
---|
54 |
|
---|
55 | #ifndef __KERNELLOG_H_
|
---|
56 | #define __KERNELLOG_H_
|
---|
57 |
|
---|
58 | #include "resource.h" // ã¡ã¤ã³ ã·ã³ãã«
|
---|
59 | #include "devicemanagerCP.h"
|
---|
60 |
|
---|
61 | /////////////////////////////////////////////////////////////////////////////
|
---|
62 | // CKernelLog
|
---|
63 | class ATL_NO_VTABLE CKernelLog :
|
---|
64 | public CComObjectRootEx<CComSingleThreadModel>,
|
---|
65 | public CComCoClass<CKernelLog, &CLSID_KernelLog>,
|
---|
66 | public IConnectionPointContainerImpl<CKernelLog>,
|
---|
67 | public IKernelLog,
|
---|
68 | public CProxy_IKernelLogEvents< CKernelLog >
|
---|
69 | {
|
---|
70 | public:
|
---|
71 | CKernelLog();
|
---|
72 | ~CKernelLog();
|
---|
73 |
|
---|
74 | DECLARE_REGISTRY_RESOURCEID(IDR_KERNELLOG)
|
---|
75 |
|
---|
76 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
77 |
|
---|
78 | BEGIN_COM_MAP(CKernelLog)
|
---|
79 | COM_INTERFACE_ENTRY(IKernelLog)
|
---|
80 | COM_INTERFACE_ENTRY(IConnectionPointContainer)
|
---|
81 | COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
---|
82 | END_COM_MAP()
|
---|
83 | BEGIN_CONNECTION_POINT_MAP(CKernelLog)
|
---|
84 | CONNECTION_POINT_ENTRY(IID__IKernelLogEvents)
|
---|
85 | END_CONNECTION_POINT_MAP()
|
---|
86 |
|
---|
87 |
|
---|
88 | // IKernelLog
|
---|
89 | public:
|
---|
90 | };
|
---|
91 |
|
---|
92 | #endif //__KERNELLOG_H_
|
---|
93 |
|
---|
94 |
|
---|
95 |
|
---|
96 | #if 0
|
---|
97 |
|
---|
98 | template <class T>
|
---|
99 | class CProxy_IKernelLogEvents : public IConnectionPointImpl<T, &IID__IKernelLogEvents, CComDynamicUnkArray>
|
---|
100 | {
|
---|
101 | public:
|
---|
102 | bool onKernelStart_Performed;
|
---|
103 |
|
---|
104 | CProxy_IKernelLogEvents(void) : onKernelStart_Performed(false) {};
|
---|
105 |
|
---|
106 | //Warning this class may be recreated by the wizard.
|
---|
107 | public:
|
---|
108 | HRESULT Fire_OnKernelStart()
|
---|
109 | {
|
---|
110 | HRESULT ret;
|
---|
111 | T* pT = static_cast<T*>(this);
|
---|
112 | int nConnectionIndex;
|
---|
113 | int nConnections = m_vec.GetSize();
|
---|
114 |
|
---|
115 | for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
---|
116 | {
|
---|
117 | pT->Lock();
|
---|
118 | CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
---|
119 | pT->Unlock();
|
---|
120 | _IKernelLogEvents* p_IKernelLogEvents = reinterpret_cast<_IKernelLogEvents*>(sp.p);
|
---|
121 | if (p_IKernelLogEvents != NULL)
|
---|
122 | ret = p_IKernelLogEvents->OnKernelStart();
|
---|
123 | }
|
---|
124 | onKernelStart_Performed = true;
|
---|
125 | return ret;
|
---|
126 | }
|
---|
127 |
|
---|
128 | HRESULT Fire_OnKernelExit()
|
---|
129 | {
|
---|
130 | HRESULT ret;
|
---|
131 | T* pT = static_cast<T*>(this);
|
---|
132 | int nConnectionIndex;
|
---|
133 | int nConnections = m_vec.GetSize();
|
---|
134 |
|
---|
135 | for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
---|
136 | {
|
---|
137 | pT->Lock();
|
---|
138 | CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
---|
139 | pT->Unlock();
|
---|
140 | _IKernelLogEvents* p_IKernelLogEvents = reinterpret_cast<_IKernelLogEvents*>(sp.p);
|
---|
141 | if (p_IKernelLogEvents != NULL)
|
---|
142 | ret = p_IKernelLogEvents->OnKernelExit();
|
---|
143 | }
|
---|
144 | onKernelStart_Performed = false;
|
---|
145 | return ret;
|
---|
146 | }
|
---|
147 |
|
---|
148 | HRESULT Fire_OnLogEvent(LONG sz, unsigned char * data)
|
---|
149 | {
|
---|
150 | HRESULT ret;
|
---|
151 | T* pT = static_cast<T*>(this);
|
---|
152 | int nConnectionIndex;
|
---|
153 | int nConnections = m_vec.GetSize();
|
---|
154 |
|
---|
155 | for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
---|
156 | {
|
---|
157 | pT->Lock();
|
---|
158 | CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
---|
159 | pT->Unlock();
|
---|
160 | _IKernelLogEvents* p_IKernelLogEvents = reinterpret_cast<_IKernelLogEvents*>(sp.p);
|
---|
161 | if (p_IKernelLogEvents != NULL)
|
---|
162 | {
|
---|
163 | if(!onKernelStart_Performed)
|
---|
164 | p_IKernelLogEvents->OnKernelStart();
|
---|
165 | ret = p_IKernelLogEvents->OnLogEvent(sz, data);
|
---|
166 | }
|
---|
167 | }
|
---|
168 | onKernelStart_Performed = true;
|
---|
169 | return ret;
|
---|
170 | }
|
---|
171 | };
|
---|
172 | #endif
|
---|