Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / platform / EFR32 / PlatformManagerImpl.h
1 /*
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *    Copyright (c) 2019 Nest Labs, Inc.
5  *
6  *    Licensed under the Apache License, Version 2.0 (the "License");
7  *    you may not use this file except in compliance with the License.
8  *    You may obtain a copy of the License at
9  *
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *    Unless required by applicable law or agreed to in writing, software
13  *    distributed under the License is distributed on an "AS IS" BASIS,
14  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *    See the License for the specific language governing permissions and
16  *    limitations under the License.
17  */
18
19 /**
20  *    @file
21  *          Provides an implementation of the PlatformManager object
22  *          for EFR32 platforms using the Silicon Labs SDK.
23  */
24
25 #pragma once
26
27 #include <platform/internal/GenericPlatformManagerImpl_FreeRTOS.h>
28
29 namespace chip {
30 namespace DeviceLayer {
31
32 /**
33  * Concrete implementation of the PlatformManager singleton object for the EFR32 platform.
34  */
35 class PlatformManagerImpl final : public PlatformManager, public Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>
36 {
37     // Allow the PlatformManager interface class to delegate method calls to
38     // the implementation methods provided by this class.
39     friend PlatformManager;
40
41     // Allow the generic implementation base class to call helper methods on
42     // this class.
43 #ifndef DOXYGEN_SHOULD_SKIP_THIS
44     friend Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>;
45 #endif
46
47 public:
48     // ===== Platform-specific members that may be accessed directly by the application.
49
50     /* none so far */
51
52 private:
53     // ===== Methods that implement the PlatformManager abstract interface.
54
55     CHIP_ERROR _InitChipStack(void);
56
57     // ===== Members for internal use by the following friends.
58
59     friend PlatformManager & PlatformMgr(void);
60     friend PlatformManagerImpl & PlatformMgrImpl(void);
61     friend class Internal::BLEManagerImpl;
62
63     static PlatformManagerImpl sInstance;
64
65     using Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::PostEventFromISR;
66 };
67
68 /**
69  * Returns the public interface of the PlatformManager singleton object.
70  *
71  * Chip applications should use this to access features of the PlatformManager object
72  * that are common to all platforms.
73  */
74 inline PlatformManager & PlatformMgr(void)
75 {
76     return PlatformManagerImpl::sInstance;
77 }
78
79 /**
80  * Returns the platform-specific implementation of the PlatformManager singleton object.
81  *
82  * Chip applications can use this to gain access to features of the PlatformManager
83  * that are specific to the ESP32 platform.
84  */
85 inline PlatformManagerImpl & PlatformMgrImpl(void)
86 {
87     return PlatformManagerImpl::sInstance;
88 }
89
90 } // namespace DeviceLayer
91 } // namespace chip