| 1 | /* |
| 2 | * Copyright (c) 2022-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_util_debug.cpp |
| 24 | //! \brief OCA Util Debug |
| 25 | //! |
| 26 | #if !EMUL |
| 27 | #include "mos_oca_util_debug.h" |
| 28 | #include "mos_os_trace_event.h" |
| 29 | |
| 30 | void OcaOnMosCriticalMessage(const PCCHAR functionName, int32_t lineNum) |
| 31 | { |
| 32 | bool isErr = true; |
| 33 | uint32_t subStrLen = 0; |
| 34 | |
| 35 | PCCHAR subStr = functionName; |
| 36 | |
| 37 | while (subStr[subStrLen]) |
| 38 | { |
| 39 | ++subStrLen; |
| 40 | if (8 == subStrLen) |
| 41 | { |
| 42 | MT_PARAM param[] = {{MT_FUNC_NAME, *(int64_t*)subStr}}; |
| 43 | OcaRtLogSectionMgr::InsertRTLog(MOS_OCA_RTLOG_COMPONENT_COMMON, isErr, MT_ERR_CRITICAL_MESSAGE, 1, param); |
| 44 | subStr += subStrLen; |
| 45 | subStrLen = 0; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | if (subStrLen > 0) |
| 50 | { |
| 51 | int64_t name = 0; |
| 52 | for (uint32_t i = 0; i < subStrLen; ++i) |
| 53 | { |
| 54 | name |= ((uint64_t)subStr[i] << (i * 8)); |
| 55 | } |
| 56 | MT_PARAM param[] = {{MT_FUNC_NAME, name}}; |
| 57 | OcaRtLogSectionMgr::InsertRTLog(MOS_OCA_RTLOG_COMPONENT_COMMON, isErr, MT_ERR_CRITICAL_MESSAGE, 1, param); |
| 58 | } |
| 59 | |
| 60 | MT_PARAM param[] = {{MT_FUNC_LINE, lineNum}}; |
| 61 | OcaRtLogSectionMgr::InsertRTLog(MOS_OCA_RTLOG_COMPONENT_COMMON, isErr, MT_ERR_CRITICAL_MESSAGE, 1, param); |
| 62 | } |
| 63 | |
| 64 | #endif |