19c6d7c21Sopenharmony_ci/*
29c6d7c21Sopenharmony_ci * Copyright (c) 2020 Huawei Device Co., Ltd.
39c6d7c21Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
49c6d7c21Sopenharmony_ci * you may not use this file except in compliance with the License.
59c6d7c21Sopenharmony_ci * You may obtain a copy of the License at
69c6d7c21Sopenharmony_ci *
79c6d7c21Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
89c6d7c21Sopenharmony_ci *
99c6d7c21Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
109c6d7c21Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
119c6d7c21Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129c6d7c21Sopenharmony_ci * See the License for the specific language governing permissions and
139c6d7c21Sopenharmony_ci * limitations under the License.
149c6d7c21Sopenharmony_ci */
159c6d7c21Sopenharmony_ci#include "time_adapter.h"
169c6d7c21Sopenharmony_ci#include <ohos_errno.h>
179c6d7c21Sopenharmony_ci#include <cmsis_os.h>
189c6d7c21Sopenharmony_ci
199c6d7c21Sopenharmony_ci#define MS_PER_SECOND 1000
209c6d7c21Sopenharmony_ci
219c6d7c21Sopenharmony_ciint32 WDT_Start(uint32 ms)
229c6d7c21Sopenharmony_ci{
239c6d7c21Sopenharmony_ci    return WDT_Reset(ms);
249c6d7c21Sopenharmony_ci}
259c6d7c21Sopenharmony_ci
269c6d7c21Sopenharmony_ciint32 WDT_Reset(uint32 ms)
279c6d7c21Sopenharmony_ci{
289c6d7c21Sopenharmony_ci    (void)ms;
299c6d7c21Sopenharmony_ci    return EC_FAILURE;
309c6d7c21Sopenharmony_ci}
319c6d7c21Sopenharmony_ci
329c6d7c21Sopenharmony_ciint32 WDT_Stop(void)
339c6d7c21Sopenharmony_ci{
349c6d7c21Sopenharmony_ci    return EC_FAILURE;
359c6d7c21Sopenharmony_ci}
369c6d7c21Sopenharmony_ci
379c6d7c21Sopenharmony_ciuint64 SAMGR_GetProcessTime(void)
389c6d7c21Sopenharmony_ci{
399c6d7c21Sopenharmony_ci    uint32 tick = osKernelGetTickCount();
409c6d7c21Sopenharmony_ci    uint32 ticksPerSecond = osKernelGetTickFreq();
419c6d7c21Sopenharmony_ci    if (ticksPerSecond == 0) {
429c6d7c21Sopenharmony_ci        return 0;
439c6d7c21Sopenharmony_ci    }
449c6d7c21Sopenharmony_ci    return (uint64)tick * MS_PER_SECOND / ticksPerSecond;
459c6d7c21Sopenharmony_ci}
46