Greg Steiert / pegasus_dev

Dependents:   blinky_max32630fthr

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arm_hal_timer.h Source File

arm_hal_timer.h

00001 /*
00002  * Copyright (c) 2014-2015 ARM Limited. All rights reserved.
00003  * SPDX-License-Identifier: Apache-2.0
00004  * Licensed under the Apache License, Version 2.0 (the License); you may
00005  * not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
00012  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #ifndef ARM_HAL_TIMER_H_
00017 #define ARM_HAL_TIMER_H_
00018 
00019 #include "eventloop_config.h"
00020 
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif
00024 /**
00025  * \brief This function perform timer init.
00026  */
00027 extern void platform_timer_enable(void);
00028 
00029 /**
00030  * \brief This function is API for set Timer interrupt handler for stack
00031  *
00032  * \param new_fp Function pointer for stack giving timer handler
00033  *
00034  */
00035 typedef void (*platform_timer_cb)(void);
00036 extern void platform_timer_set_cb(platform_timer_cb new_fp);
00037 
00038 /**
00039  * \brief This function is API for stack timer start
00040  *
00041  * \param slots define how many 50us slot time period will be started
00042  *
00043  */
00044 extern void platform_timer_start(uint16_t slots);
00045 
00046 /**
00047  * \brief This function is API for stack timer stop
00048  *
00049  */
00050 extern void platform_timer_disable(void);
00051 
00052 /**
00053  * \brief This function is API for stack timer to read active timer remaining slot count
00054  *
00055  * \return 50us time slot remaining
00056  */
00057 extern uint16_t platform_timer_get_remaining_slots(void);
00058 
00059 #ifdef NS_EVENTLOOP_USE_TICK_TIMER
00060 /**
00061  * \brief This function is API for registering low resolution tick timer callback. Also does
00062  *        any necessary initialization of the tick timer.
00063  *
00064  * \return -1 for failure, success otherwise
00065  */
00066 extern int8_t platform_tick_timer_register(void (*tick_timer_cb_handler)(void));
00067 
00068 /**
00069  * \brief This function is API for starting the low resolution tick timer. The callback
00070  *        set with platform_tick_timer_register gets called periodically until stopped
00071  *        by calling platform_tick_timer_stop.
00072  *
00073  * \param period_ms define how many milliseconds time period will be started
00074  * \return -1 for failure, success otherwise
00075  */
00076 extern int8_t platform_tick_timer_start(uint32_t period_ms);
00077 
00078 /**
00079  * \brief This function is API for stopping the low resolution tick timer
00080  *
00081  * \return -1 for failure, success otherwise
00082  */
00083 extern int8_t platform_tick_timer_stop(void);
00084 
00085 #endif // NS_EVENTLOOP_USE_TICK_TIMER
00086 
00087 #ifdef __cplusplus
00088 }
00089 #endif
00090 
00091 #endif /* ARM_HAL_TIMER_H_ */