Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers protocol_timer.h Source File

protocol_timer.h

00001 /*
00002  * Copyright (c) 2014-2017, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef PROTOCOL_TIMER_H_
00019 #define PROTOCOL_TIMER_H_
00020 
00021 typedef enum {
00022     PROTOCOL_TIMER_MLE_TIM_UPDATE = 0,
00023     PROTOCOL_TIMER_STACK_TIM,
00024     PROTOCOL_TIMER_TCP_TIM,
00025     PROTOCOL_TIMER_MULTICAST_TIM,
00026     PROTOCOL_TIMER_BOOTSTRAP_TIM,
00027     PROTOCOL_TIMER_MAX
00028 } protocol_timer_id_t;
00029 
00030 typedef struct {
00031     void (*fptr)(uint16_t);
00032     uint16_t ticks;
00033     uint16_t orderedTime;
00034     uint16_t time_drifts;
00035 } protocol_timer_t;
00036 
00037 extern int protocol_timer_init(void);
00038 extern void protocol_timer_event_lock_free(void);
00039 extern void protocol_timer_cb(uint16_t ticks);
00040 extern void protocol_timer_interrupt(int8_t timer_id, uint16_t slots);
00041 extern void protocol_timer_start(protocol_timer_id_t id, void (*passed_fptr)(uint16_t), uint32_t time_ms);
00042 extern void protocol_timer_stop(protocol_timer_id_t id);
00043 extern void protocol_timer_sleep_balance(uint32_t time_in_ms);
00044 
00045 #endif /* PROTOCOL_TIMER_H_ */