mbed library sources. Supersedes mbed-src.
Fork of mbed-dev by
targets/TARGET_NORDIC/TARGET_NRF5/common_rtc.h@162:16168a1438f3, 2017-04-08 (annotated)
- Committer:
- funshine
- Date:
- Sat Apr 08 17:03:55 2017 +0000
- Revision:
- 162:16168a1438f3
- Parent:
- 149:156823d33999
add code to handle serial port rx error in uart_irq()
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 144:ef7eb2e8f9f7 | 1 | /* mbed Microcontroller Library |
<> | 144:ef7eb2e8f9f7 | 2 | * Copyright (c) 2015 ARM Limited |
<> | 144:ef7eb2e8f9f7 | 3 | * |
<> | 144:ef7eb2e8f9f7 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
<> | 144:ef7eb2e8f9f7 | 5 | * you may not use this file except in compliance with the License. |
<> | 144:ef7eb2e8f9f7 | 6 | * You may obtain a copy of the License at |
<> | 144:ef7eb2e8f9f7 | 7 | * |
<> | 144:ef7eb2e8f9f7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
<> | 144:ef7eb2e8f9f7 | 9 | * |
<> | 144:ef7eb2e8f9f7 | 10 | * Unless required by applicable law or agreed to in writing, software |
<> | 144:ef7eb2e8f9f7 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
<> | 144:ef7eb2e8f9f7 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
<> | 144:ef7eb2e8f9f7 | 13 | * See the License for the specific language governing permissions and |
<> | 144:ef7eb2e8f9f7 | 14 | * limitations under the License. |
<> | 144:ef7eb2e8f9f7 | 15 | */ |
<> | 144:ef7eb2e8f9f7 | 16 | |
<> | 144:ef7eb2e8f9f7 | 17 | #ifndef COMMON_RTC_H |
<> | 144:ef7eb2e8f9f7 | 18 | #define COMMON_RTC_H |
<> | 144:ef7eb2e8f9f7 | 19 | |
<> | 144:ef7eb2e8f9f7 | 20 | #include "nrf_rtc.h" |
<> | 144:ef7eb2e8f9f7 | 21 | |
<> | 144:ef7eb2e8f9f7 | 22 | #define RTC_COUNTER_BITS 24u |
<> | 144:ef7eb2e8f9f7 | 23 | |
<> | 144:ef7eb2e8f9f7 | 24 | // Instance 0 is reserved for SoftDevice. |
<> | 144:ef7eb2e8f9f7 | 25 | // Instance 1 is used as a common one for us_ticker, lp_ticker and (in case |
<> | 144:ef7eb2e8f9f7 | 26 | // of NRF51) as an alternative tick source for RTOS. |
<> | 144:ef7eb2e8f9f7 | 27 | // ["us_ticker.c" uses hard coded addresses of the 'NRF_RTC1->EVENT_COMPARE[1]' |
<> | 144:ef7eb2e8f9f7 | 28 | // register in inline assembly implementations of COMMON_RTC_IRQ_HANDLER, |
<> | 144:ef7eb2e8f9f7 | 29 | // please remember to update those in case of doing changes here] |
<> | 144:ef7eb2e8f9f7 | 30 | #define COMMON_RTC_INSTANCE NRF_RTC1 |
<> | 144:ef7eb2e8f9f7 | 31 | #define COMMON_RTC_IRQ_HANDLER RTC1_IRQHandler |
<> | 144:ef7eb2e8f9f7 | 32 | #define US_TICKER_CC_CHANNEL 0 |
<> | 144:ef7eb2e8f9f7 | 33 | #define OS_TICK_CC_CHANNEL 1 |
<> | 144:ef7eb2e8f9f7 | 34 | #define LP_TICKER_CC_CHANNEL 2 |
<> | 144:ef7eb2e8f9f7 | 35 | |
<> | 144:ef7eb2e8f9f7 | 36 | #define COMMON_RTC_EVENT_COMPARE(channel) \ |
<> | 144:ef7eb2e8f9f7 | 37 | CONCAT_2(NRF_RTC_EVENT_COMPARE_, channel) |
<> | 144:ef7eb2e8f9f7 | 38 | #define COMMON_RTC_INT_COMPARE_MASK(channel) \ |
<> | 144:ef7eb2e8f9f7 | 39 | CONCAT_3(NRF_RTC_INT_COMPARE, channel, _MASK) |
<> | 144:ef7eb2e8f9f7 | 40 | |
<> | 144:ef7eb2e8f9f7 | 41 | #define US_TICKER_EVENT COMMON_RTC_EVENT_COMPARE(US_TICKER_CC_CHANNEL) |
<> | 144:ef7eb2e8f9f7 | 42 | #define US_TICKER_INT_MASK COMMON_RTC_INT_COMPARE_MASK(US_TICKER_CC_CHANNEL) |
<> | 144:ef7eb2e8f9f7 | 43 | #define OS_TICK_EVENT COMMON_RTC_EVENT_COMPARE(OS_TICK_CC_CHANNEL) |
<> | 144:ef7eb2e8f9f7 | 44 | #define OS_TICK_INT_MASK COMMON_RTC_INT_COMPARE_MASK(OS_TICK_CC_CHANNEL) |
<> | 144:ef7eb2e8f9f7 | 45 | #define LP_TICKER_EVENT COMMON_RTC_EVENT_COMPARE(LP_TICKER_CC_CHANNEL) |
<> | 144:ef7eb2e8f9f7 | 46 | #define LP_TICKER_INT_MASK COMMON_RTC_INT_COMPARE_MASK(LP_TICKER_CC_CHANNEL) |
<> | 144:ef7eb2e8f9f7 | 47 | |
<> | 144:ef7eb2e8f9f7 | 48 | extern bool m_common_rtc_enabled; |
<> | 144:ef7eb2e8f9f7 | 49 | extern uint32_t volatile m_common_rtc_overflows; |
<> | 144:ef7eb2e8f9f7 | 50 | |
<> | 144:ef7eb2e8f9f7 | 51 | void common_rtc_init(void); |
<> | 144:ef7eb2e8f9f7 | 52 | uint32_t common_rtc_32bit_ticks_get(void); |
<> | 144:ef7eb2e8f9f7 | 53 | uint64_t common_rtc_64bit_us_get(void); |
<> | 144:ef7eb2e8f9f7 | 54 | void common_rtc_set_interrupt(uint32_t us_timestamp, uint32_t cc_channel, |
<> | 144:ef7eb2e8f9f7 | 55 | uint32_t int_mask); |
<> | 144:ef7eb2e8f9f7 | 56 | |
<> | 144:ef7eb2e8f9f7 | 57 | #endif // COMMON_RTC_H |