2019-09-03 03:49:58 +00:00
|
|
|
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "esp_err.h"
|
|
|
|
|
2021-06-09 07:31:56 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-09-03 03:49:58 +00:00
|
|
|
/**
|
|
|
|
* @brief Start the timer on the current core.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* - ESP_OK: Success
|
|
|
|
* - ESP_ERR_INVALID_STATE: The timer has already been started previously.
|
|
|
|
* - Others: Fail
|
|
|
|
*/
|
|
|
|
esp_err_t ccomp_timer_start(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Stop the timer on the current core.
|
2020-11-10 07:40:01 +00:00
|
|
|
*
|
2019-09-03 03:49:58 +00:00
|
|
|
* @note Returns -1 if an error has occured and stopping the timer failed.
|
|
|
|
*
|
|
|
|
* @return The time elapsed from the last ccomp_timer_start call on the current
|
|
|
|
* core.
|
|
|
|
*/
|
|
|
|
int64_t ccomp_timer_stop(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the current timer value on the current core without stopping the timer.
|
|
|
|
*
|
|
|
|
* @note Returns -1 if an error has occured and stopping the timer failed.
|
2020-11-10 07:40:01 +00:00
|
|
|
*
|
2019-09-03 03:49:58 +00:00
|
|
|
* @note If called while timer is active i.e. between ccomp_timer_start and ccomp_timer_stop,
|
2020-11-10 07:40:01 +00:00
|
|
|
* this function returns the elapsed time from ccomp_timer_start. Once ccomp_timer_stop
|
2019-09-03 03:49:58 +00:00
|
|
|
* has been called, the timer becomes inactive and stops keeping time. As a result, if this function gets
|
|
|
|
* called after esp_cccomp_timer_stop, this function will return the same value as when the timer was stopped.
|
|
|
|
*
|
2020-11-10 07:40:01 +00:00
|
|
|
* @return The elapsed time from the last ccomp_timer_start call on the current
|
2019-09-03 03:49:58 +00:00
|
|
|
* core.
|
|
|
|
*/
|
|
|
|
int64_t ccomp_timer_get_time(void);
|
2021-06-09 07:31:56 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|