Toyomasa Watarai
/
Mbed-example-WS-W27
simple-mbed-cloud-client/mbed-cloud-client/sal-stack-nanostack-eventloop/source/timer_sys.h@0:119624335925, 2018-06-30 (annotated)
- Committer:
- MACRUM
- Date:
- Sat Jun 30 01:40:30 2018 +0000
- Revision:
- 0:119624335925
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MACRUM | 0:119624335925 | 1 | /* |
MACRUM | 0:119624335925 | 2 | * Copyright (c) 2014-2015 ARM Limited. All rights reserved. |
MACRUM | 0:119624335925 | 3 | * SPDX-License-Identifier: Apache-2.0 |
MACRUM | 0:119624335925 | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
MACRUM | 0:119624335925 | 5 | * not use this file except in compliance with the License. |
MACRUM | 0:119624335925 | 6 | * You may obtain a copy of the License at |
MACRUM | 0:119624335925 | 7 | * |
MACRUM | 0:119624335925 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
MACRUM | 0:119624335925 | 9 | * |
MACRUM | 0:119624335925 | 10 | * Unless required by applicable law or agreed to in writing, software |
MACRUM | 0:119624335925 | 11 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
MACRUM | 0:119624335925 | 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
MACRUM | 0:119624335925 | 13 | * See the License for the specific language governing permissions and |
MACRUM | 0:119624335925 | 14 | * limitations under the License. |
MACRUM | 0:119624335925 | 15 | */ |
MACRUM | 0:119624335925 | 16 | #ifndef _PL_NANO_TIMER_SYS_H_ |
MACRUM | 0:119624335925 | 17 | #define _PL_NANO_TIMER_SYS_H_ |
MACRUM | 0:119624335925 | 18 | |
MACRUM | 0:119624335925 | 19 | #ifdef __cplusplus |
MACRUM | 0:119624335925 | 20 | extern "C" { |
MACRUM | 0:119624335925 | 21 | #endif |
MACRUM | 0:119624335925 | 22 | |
MACRUM | 0:119624335925 | 23 | #include "eventOS_event.h" |
MACRUM | 0:119624335925 | 24 | |
MACRUM | 0:119624335925 | 25 | /* We borrow base event storage, including its list link, and add a time field */ |
MACRUM | 0:119624335925 | 26 | typedef struct sys_timer_struct_s { |
MACRUM | 0:119624335925 | 27 | arm_event_storage_t event; |
MACRUM | 0:119624335925 | 28 | uint32_t launch_time; // tick value |
MACRUM | 0:119624335925 | 29 | uint32_t period; |
MACRUM | 0:119624335925 | 30 | } sys_timer_struct_s; |
MACRUM | 0:119624335925 | 31 | |
MACRUM | 0:119624335925 | 32 | |
MACRUM | 0:119624335925 | 33 | /** |
MACRUM | 0:119624335925 | 34 | * Initialize system timer |
MACRUM | 0:119624335925 | 35 | * */ |
MACRUM | 0:119624335925 | 36 | extern void timer_sys_init(void); |
MACRUM | 0:119624335925 | 37 | |
MACRUM | 0:119624335925 | 38 | extern uint32_t timer_get_runtime_ticks(void); |
MACRUM | 0:119624335925 | 39 | int8_t timer_sys_wakeup(void); |
MACRUM | 0:119624335925 | 40 | void timer_sys_disable(void); |
MACRUM | 0:119624335925 | 41 | void timer_sys_event_free(struct arm_event_storage *event); |
MACRUM | 0:119624335925 | 42 | |
MACRUM | 0:119624335925 | 43 | // This require lock to be held |
MACRUM | 0:119624335925 | 44 | void timer_sys_event_cancel_critical(struct arm_event_storage *event); |
MACRUM | 0:119624335925 | 45 | |
MACRUM | 0:119624335925 | 46 | /** |
MACRUM | 0:119624335925 | 47 | * System Timer update and synch after sleep |
MACRUM | 0:119624335925 | 48 | * |
MACRUM | 0:119624335925 | 49 | * \param ticks Time in 10 ms resolution |
MACRUM | 0:119624335925 | 50 | * |
MACRUM | 0:119624335925 | 51 | * \return none |
MACRUM | 0:119624335925 | 52 | * |
MACRUM | 0:119624335925 | 53 | * */ |
MACRUM | 0:119624335925 | 54 | void system_timer_tick_update(uint32_t ticks); |
MACRUM | 0:119624335925 | 55 | |
MACRUM | 0:119624335925 | 56 | #ifdef __cplusplus |
MACRUM | 0:119624335925 | 57 | } |
MACRUM | 0:119624335925 | 58 | #endif |
MACRUM | 0:119624335925 | 59 | |
MACRUM | 0:119624335925 | 60 | #endif /*_PL_NANO_TIMER_SYS_H_*/ |