Xenomai  3.0.5
tdma_proto.h
1 /***
2  *
3  * include/rtmac/tdma/tdma_proto.h
4  *
5  * RTmac - real-time networking media access control subsystem
6  * Copyright (C) 2002 Marc Kleine-Budde <kleine-budde@gmx.de>,
7  * 2003, 2004 Jan Kiszka <Jan.Kiszka@web.de>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  *
23  */
24 
25 #ifndef __TDMA_PROTO_H_
26 #define __TDMA_PROTO_H_
27 
28 #include <rtdev.h>
29 
30 #include <rtmac/tdma/tdma.h>
31 
32 
33 #define TDMA_FRM_VERSION 0x0201
34 
35 #define TDMA_FRM_SYNC 0x0000
36 #define TDMA_FRM_REQ_CAL 0x0010
37 #define TDMA_FRM_RPL_CAL 0x0011
38 
39 
40 struct tdma_frm_head {
41  u16 version;
42  u16 id;
43 } __attribute__((packed));
44 
45 
46 #define SYNC_FRM(head) ((struct tdma_frm_sync *)(head))
47 
48 struct tdma_frm_sync {
49  struct tdma_frm_head head;
50  u32 cycle_no;
51  u64 xmit_stamp;
52  u64 sched_xmit_stamp;
53 } __attribute__((packed));
54 
55 
56 #define REQ_CAL_FRM(head) ((struct tdma_frm_req_cal *)(head))
57 
58 struct tdma_frm_req_cal {
59  struct tdma_frm_head head;
60  u64 xmit_stamp;
61  u32 reply_cycle;
62  u64 reply_slot_offset;
63 } __attribute__((packed));
64 
65 
66 #define RPL_CAL_FRM(head) ((struct tdma_frm_rpl_cal *)(head))
67 
68 struct tdma_frm_rpl_cal {
69  struct tdma_frm_head head;
70  u64 request_xmit_stamp;
71  u64 reception_stamp;
72  u64 xmit_stamp;
73 } __attribute__((packed));
74 
75 
76 void tdma_xmit_sync_frame(struct tdma_priv *tdma);
77 int tdma_xmit_request_cal_frame(struct tdma_priv *tdma, u32 reply_cycle,
78  u64 reply_slot_offset);
79 
80 int tdma_rt_packet_tx(struct rtskb *rtskb, struct rtnet_device *rtdev);
81 int tdma_nrt_packet_tx(struct rtskb *rtskb);
82 
83 int tdma_packet_rx(struct rtskb *rtskb);
84 
85 unsigned int tdma_get_mtu(struct rtnet_device *rtdev, unsigned int priority);
86 
87 #endif /* __TDMA_PROTO_H_ */