| 1 | /* |
| 2 | * Copyright (c) 2023, Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice shall be included |
| 12 | * in all copies or substantial portions of the Software. |
| 13 | * |
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 | * OTHER DEALINGS IN THE SOFTWARE. |
| 21 | */ |
| 22 | //! |
| 23 | //! \file mos_oca_buffer_mgr_base.h |
| 24 | //! \brief |
| 25 | //! |
| 26 | //! |
| 27 | //! \file mos_oca_buffer_mgr.h |
| 28 | //! \brief Container class for OCA buffer manager wrapper |
| 29 | //! \details Container class for OCA buffer manager wrapper |
| 30 | //! |
| 31 | |
| 32 | #ifndef __MOS_OCA_RTLOG_MGR_BASE_H__ |
| 33 | #define __MOS_OCA_RTLOG_MGR_BASE_H__ |
| 34 | |
| 35 | #include "mos_oca_rtlog_mgr_defs.h" |
| 36 | #include "mos_os_specific.h" |
| 37 | #include "mos_utilities.h" |
| 38 | #include <vector> |
| 39 | |
| 40 | class OsContextNext; |
| 41 | class OsContextSpecificNext; |
| 42 | |
| 43 | struct MOS_OCA_RTLOG_RES_AND_INTERFACE |
| 44 | { |
| 45 | PMOS_RESOURCE ocaRTLogResource = nullptr; |
| 46 | PMOS_INTERFACE osInterface = nullptr; |
| 47 | }; |
| 48 | |
| 49 | class MosOcaRTLogMgrBase |
| 50 | { |
| 51 | public: |
| 52 | bool IsMgrInitialized() { return m_isMgrInitialized; }; |
| 53 | |
| 54 | uint32_t GetRtlogHeapSize() { return m_heapSize; }; |
| 55 | |
| 56 | static bool IsOcaRTLogEnabled() { return s_enableOcaRTLog; }; |
| 57 | |
| 58 | protected: |
| 59 | int32_t GetGlobleIndex(); |
| 60 | |
| 61 | OsContextNext *m_osContext = nullptr; |
| 62 | int32_t m_globleIndex = -1; |
| 63 | bool m_isMgrInitialized = false; |
| 64 | uint32_t m_heapSize = MAX_OCA_RT_SIZE; |
| 65 | uint8_t *m_heapAddr = nullptr; |
| 66 | |
| 67 | static bool s_enableOcaRTLog; |
| 68 | static MosMutex s_ocaMutex; |
| 69 | static bool s_isOcaRtlogMgrDestoryed; |
| 70 | |
| 71 | MEDIA_CLASS_DEFINE_END(MosOcaRTLogMgrBase) |
| 72 | }; |
| 73 | |
| 74 | #endif //__MOS_OCA_RTLOG_MGR_BASE_H__ |