Contiki-NG
Toggle main menu visibility
Loading...
Searching...
No Matches
tsch-slot-operation.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015, SICS Swedish ICT.
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
* 1. Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* 2. Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* 3. Neither the name of the Institute nor the names of its contributors
14
* may be used to endorse or promote products derived from this software
15
* without specific prior written permission.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
* SUCH DAMAGE.
28
*
29
* This file is part of the Contiki operating system.
30
*
31
*/
32
33
/**
34
* \addtogroup tsch
35
* @{
36
* \file
37
* TSCH runtime operation within timeslots
38
*/
39
40
#ifndef TSCH_SLOT_OPERATION_H_
41
#define TSCH_SLOT_OPERATION_H_
42
43
/********** Includes **********/
44
45
#include "contiki.h"
46
#include "
lib/ringbufindex.h
"
47
48
/***** External Variables *****/
49
50
/* A ringbuf storing outgoing packets after they were dequeued.
51
* Will be processed layer by tsch_tx_process_pending */
52
extern
struct
ringbufindex dequeued_ringbuf;
53
extern
struct
tsch_packet
*dequeued_array[TSCH_DEQUEUED_ARRAY_SIZE];
54
/* A ringbuf storing incoming packets.
55
* Will be processed layer by tsch_rx_process_pending */
56
extern
struct
ringbufindex input_ringbuf;
57
extern
struct
input_packet
input_array[TSCH_MAX_INCOMING_PACKETS];
58
/* Last clock_time_t where synchronization happened */
59
extern
clock_time_t tsch_last_sync_time;
60
/* Counts the length of the current burst */
61
extern
int
tsch_current_burst_count;
62
63
/********** Functions *********/
64
65
/**
66
* Checks if the TSCH lock is set. Accesses to global structures outside of
67
* interrupts must be done through the lock, unless the sturcutre has
68
* atomic read/write
69
*
70
* \return 1 if the lock is taken, 0 otherwise
71
*/
72
int
tsch_is_locked
(
void
);
73
/**
74
* Takes the TSCH lock. When the lock is taken, slot operation will be skipped
75
* until release.
76
*
77
* \return 1 if the lock was successfully taken, 0 otherwise
78
*/
79
int
tsch_get_lock
(
void
);
80
/**
81
* Releases the TSCH lock.
82
*/
83
void
tsch_release_lock
(
void
);
84
/**
85
* Set global time before starting slot operation, with a rtimer time and an ASN
86
*
87
* \param next_slot_start the time to the start of the next slot, in rtimer ticks
88
* \param next_slot_asn the ASN of the next slot
89
*/
90
void
tsch_slot_operation_sync
(rtimer_clock_t next_slot_start,
91
struct
tsch_asn_t
*next_slot_asn);
92
/**
93
* Start actual slot operation
94
*/
95
void
tsch_slot_operation_start
(
void
);
96
97
#endif
/* TSCH_SLOT_OPERATION_H_ */
98
/** @} */
tsch_get_lock
int tsch_get_lock(void)
Takes the TSCH lock.
Definition
tsch-slot-operation.c:193
tsch_slot_operation_sync
void tsch_slot_operation_sync(rtimer_clock_t next_slot_start, struct tsch_asn_t *next_slot_asn)
Set global time before starting slot operation, with a rtimer time and an ASN.
Definition
tsch-slot-operation.c:1226
tsch_release_lock
void tsch_release_lock(void)
Releases the TSCH lock.
Definition
tsch-slot-operation.c:232
tsch_is_locked
int tsch_is_locked(void)
Checks if the TSCH lock is set.
Definition
tsch-slot-operation.c:186
tsch_slot_operation_start
void tsch_slot_operation_start(void)
Start actual slot operation.
Definition
tsch-slot-operation.c:1197
ringbufindex.h
Header file for the ringbufindex library.
input_packet
Stores data about an incoming packet.
Definition
tsch-types.h:148
tsch_asn_t
The ASN is an absolute slot number over 5 bytes.
Definition
tsch-asn.h:48
tsch_packet
TSCH packet information.
Definition
tsch-types.h:97
os
net
mac
tsch
tsch-slot-operation.h
Generated on
for Contiki-NG by
1.17.0