Nicolas Borla / Mbed OS BBR_1Ebene
Committer:
borlanic
Date:
Mon May 14 11:29:06 2018 +0000
Revision:
0:fbdae7e6d805
BBR

Who changed what in which revision?

UserRevisionLine numberNew contents of line
borlanic 0:fbdae7e6d805 1
borlanic 0:fbdae7e6d805 2 /** \addtogroup hal */
borlanic 0:fbdae7e6d805 3 /** @{*/
borlanic 0:fbdae7e6d805 4 /* mbed Microcontroller Library
borlanic 0:fbdae7e6d805 5 * Copyright (c) 2006-2015 ARM Limited
borlanic 0:fbdae7e6d805 6 *
borlanic 0:fbdae7e6d805 7 * Licensed under the Apache License, Version 2.0 (the "License");
borlanic 0:fbdae7e6d805 8 * you may not use this file except in compliance with the License.
borlanic 0:fbdae7e6d805 9 * You may obtain a copy of the License at
borlanic 0:fbdae7e6d805 10 *
borlanic 0:fbdae7e6d805 11 * http://www.apache.org/licenses/LICENSE-2.0
borlanic 0:fbdae7e6d805 12 *
borlanic 0:fbdae7e6d805 13 * Unless required by applicable law or agreed to in writing, software
borlanic 0:fbdae7e6d805 14 * distributed under the License is distributed on an "AS IS" BASIS,
borlanic 0:fbdae7e6d805 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
borlanic 0:fbdae7e6d805 16 * See the License for the specific language governing permissions and
borlanic 0:fbdae7e6d805 17 * limitations under the License.
borlanic 0:fbdae7e6d805 18 */
borlanic 0:fbdae7e6d805 19 #ifndef MBED_US_TICKER_API_H
borlanic 0:fbdae7e6d805 20 #define MBED_US_TICKER_API_H
borlanic 0:fbdae7e6d805 21
borlanic 0:fbdae7e6d805 22 #include <stdint.h>
borlanic 0:fbdae7e6d805 23 #include "hal/ticker_api.h"
borlanic 0:fbdae7e6d805 24
borlanic 0:fbdae7e6d805 25 #ifdef __cplusplus
borlanic 0:fbdae7e6d805 26 extern "C" {
borlanic 0:fbdae7e6d805 27 #endif
borlanic 0:fbdae7e6d805 28
borlanic 0:fbdae7e6d805 29 /**
borlanic 0:fbdae7e6d805 30 * \defgroup hal_UsTicker Microseconds Ticker Functions
borlanic 0:fbdae7e6d805 31 * @{
borlanic 0:fbdae7e6d805 32 */
borlanic 0:fbdae7e6d805 33
borlanic 0:fbdae7e6d805 34 typedef void (*ticker_irq_handler_type)(const ticker_data_t *const);
borlanic 0:fbdae7e6d805 35
borlanic 0:fbdae7e6d805 36 /** Set ticker IRQ handler
borlanic 0:fbdae7e6d805 37 *
borlanic 0:fbdae7e6d805 38 * @param ticker_irq_handler IRQ handler to be connected
borlanic 0:fbdae7e6d805 39 *
borlanic 0:fbdae7e6d805 40 * @return previous ticker IRQ handler
borlanic 0:fbdae7e6d805 41 *
borlanic 0:fbdae7e6d805 42 * @note by default IRQ handler is set to ticker_irq_handler()
borlanic 0:fbdae7e6d805 43 * @note this function is primarily for testing purposes and it's not required part of HAL implementation
borlanic 0:fbdae7e6d805 44 *
borlanic 0:fbdae7e6d805 45 */
borlanic 0:fbdae7e6d805 46 ticker_irq_handler_type set_us_ticker_irq_handler(ticker_irq_handler_type ticker_irq_handler);
borlanic 0:fbdae7e6d805 47
borlanic 0:fbdae7e6d805 48 /** Get ticker's data
borlanic 0:fbdae7e6d805 49 *
borlanic 0:fbdae7e6d805 50 * @return The low power ticker data
borlanic 0:fbdae7e6d805 51 */
borlanic 0:fbdae7e6d805 52 const ticker_data_t* get_us_ticker_data(void);
borlanic 0:fbdae7e6d805 53
borlanic 0:fbdae7e6d805 54
borlanic 0:fbdae7e6d805 55 /** The wrapper for ticker_irq_handler, to pass us ticker's data
borlanic 0:fbdae7e6d805 56 *
borlanic 0:fbdae7e6d805 57 */
borlanic 0:fbdae7e6d805 58 void us_ticker_irq_handler(void);
borlanic 0:fbdae7e6d805 59
borlanic 0:fbdae7e6d805 60 /* HAL us ticker */
borlanic 0:fbdae7e6d805 61
borlanic 0:fbdae7e6d805 62 /** Initialize the ticker
borlanic 0:fbdae7e6d805 63 *
borlanic 0:fbdae7e6d805 64 */
borlanic 0:fbdae7e6d805 65 void us_ticker_init(void);
borlanic 0:fbdae7e6d805 66
borlanic 0:fbdae7e6d805 67 /** Read the current counter
borlanic 0:fbdae7e6d805 68 *
borlanic 0:fbdae7e6d805 69 * @return The current timer's counter value in microseconds
borlanic 0:fbdae7e6d805 70 */
borlanic 0:fbdae7e6d805 71 uint32_t us_ticker_read(void);
borlanic 0:fbdae7e6d805 72
borlanic 0:fbdae7e6d805 73 /** Set interrupt for specified timestamp
borlanic 0:fbdae7e6d805 74 *
borlanic 0:fbdae7e6d805 75 * @param timestamp The time in microseconds to be set
borlanic 0:fbdae7e6d805 76 */
borlanic 0:fbdae7e6d805 77 void us_ticker_set_interrupt(timestamp_t timestamp);
borlanic 0:fbdae7e6d805 78
borlanic 0:fbdae7e6d805 79 /** Disable us ticker interrupt
borlanic 0:fbdae7e6d805 80 *
borlanic 0:fbdae7e6d805 81 */
borlanic 0:fbdae7e6d805 82 void us_ticker_disable_interrupt(void);
borlanic 0:fbdae7e6d805 83
borlanic 0:fbdae7e6d805 84 /** Clear us ticker interrupt
borlanic 0:fbdae7e6d805 85 *
borlanic 0:fbdae7e6d805 86 */
borlanic 0:fbdae7e6d805 87 void us_ticker_clear_interrupt(void);
borlanic 0:fbdae7e6d805 88
borlanic 0:fbdae7e6d805 89 /** Set pending interrupt that should be fired right away.
borlanic 0:fbdae7e6d805 90 *
borlanic 0:fbdae7e6d805 91 * The ticker should be initialized prior calling this function.
borlanic 0:fbdae7e6d805 92 */
borlanic 0:fbdae7e6d805 93 void us_ticker_fire_interrupt(void);
borlanic 0:fbdae7e6d805 94
borlanic 0:fbdae7e6d805 95 /** Get frequency and counter bits of this ticker.
borlanic 0:fbdae7e6d805 96 *
borlanic 0:fbdae7e6d805 97 */
borlanic 0:fbdae7e6d805 98 const ticker_info_t* us_ticker_get_info(void);
borlanic 0:fbdae7e6d805 99
borlanic 0:fbdae7e6d805 100 /**@}*/
borlanic 0:fbdae7e6d805 101
borlanic 0:fbdae7e6d805 102 #ifdef __cplusplus
borlanic 0:fbdae7e6d805 103 }
borlanic 0:fbdae7e6d805 104 #endif
borlanic 0:fbdae7e6d805 105
borlanic 0:fbdae7e6d805 106 #endif
borlanic 0:fbdae7e6d805 107
borlanic 0:fbdae7e6d805 108 /** @}*/