Merged r6329:6428 of features/inband-usb + distcheck fixes into trunk.
[debian/gnuradio] / usrp / host / apps-inband / gmac.mbh
1 ;; -*- scheme -*- ; not really, but tells emacs how to format this
2 ;;
3 ;; Copyright 2007 Free Software Foundation, Inc.
4 ;; 
5 ;; This file is part of GNU Radio
6 ;; 
7 ;; GNU Radio is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 2, or (at your option)
10 ;; any later version.
11 ;; 
12 ;; GNU Radio is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ;; GNU General Public License for more details.
16 ;; 
17 ;; You should have received a copy of the GNU General Public License along
18 ;; with this program; if not, write to the Free Software Foundation, Inc.,
19 ;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 ;;
21
22 ;; ----------------------------------------------------------------
23 ;;              This is an mblock header file
24 ;;
25 ;; The format is very much a work-in-progress.
26 ;; It'll be compiled to C++.
27 ;; ----------------------------------------------------------------
28
29 ;; In the outgoing messages described below, invocation-handle is an
30 ;; identifier provided by the client to tag the method invocation.
31 ;; The identifier will be returned with the response, to provide the
32 ;; client with a mechanism to match asynchronous responses with the
33 ;; commands that generate them.  The value of the invocation-handle is
34 ;; opaque the the server, and is not required by the server to be
35 ;; unique.
36 ;;
37 ;; In the incoming messages described below, invocation-handle is the
38 ;; identifier provided by the client in the prompting invocation.  The
39 ;; identifier is returned with the response, so that the client has a
40 ;; mechanism to match asynchronous responses with the commands that
41 ;; generated them.
42 ;;
43 ;; status is either #t, indicating success, or a symbol indicating an error.
44 ;; All symbol's names shall begin with %error-
45
46
47 ;; ----------------------------------------------------------------
48 ;; gmac-tx
49 ;;
50 ;; The protocol class is defined from the client's point-of-view.
51 ;; (The client port is unconjugated, the server port is conjugated.)
52
53 (define-protocol-class gmac-tx
54
55   (:outgoing
56
57     ;; Transmitting packets can carry an invocation handle so the application
58     ;; can get TX results on specific packets, such as whether a packet tagged
59     ;; as #1 was successfully transmitted or not.  This would allow the
60     ;; application to implement something sliding window like.
61     ;;
62     ;; 'dst' is the destination MAC address (given a MAC addressing scheme)
63     ;;
64     ;; 'data' will be treated transparently and passed on as samples.
65     ;;
66     ;; 'properties' can be used in the future to set per-packet options such as
67     ;;   carrier sense overriding functionality.
68     (cmd-tx-pkt invocation-handle dst data properties)
69
70    )
71
72   (:incoming
73
74     ;; The response will carry the same invocation-handle passed with cmd-tx-pkt
75     (response-tx-pkt invocation-handle status)
76
77    )
78   )
79
80 ;; ----------------------------------------------------------------
81 ;; gmac-rx
82 ;;
83 ;; The protocol class is defined from the client's point-of-view.
84 ;; (The client port is unconjugated, the server port is conjugated.)
85
86 (define-protocol-class gmac-rx
87
88   (:outgoing
89     
90     ;; There are currently no outgoing commands, I believe that the RX
91     ;; should always be enabled, there is no point in having an enable/disable
92     ;; that I can see.
93    
94    )
95
96   (:incoming
97
98     ;; Contains packets decoded by the MAC destined for this machine, sent by
99     ;; the specified address.
100     (response-rx-pkt invocation-handle src data)
101
102    )
103   )
104
105
106 ;; ----------------------------------------------------------------
107 ;; gmac-cs
108 ;;
109 ;; The protocol class is defined from the client's point-of-view.
110 ;; (The client port is unconjugated, the server port is conjugated.)
111 ;;
112 ;; This defines a control/status interface to the MAC layer, for control over
113 ;; functionality such as carrier sense and future functionality such as channel
114 ;; hopping.
115
116
117 (define-protocol-class gmac-cs
118
119   (:outgoing
120
121     ;; Threshold represents the carrier sense threshold based on the digital
122     ;; reading out of the DAC.  If the threshold is set to PMT_NIL then the
123     ;; MAC will use averaging to determine an appropriate threshold.
124     (cmd-carrier-sense-enable invocation-handle threshold deadline)
125     (cmd-carrier-sense-threshold invocation-handle threshold)
126     (cmd-carrier-sense-disable invocation-handle)
127
128     ;; Setting the number of fast transmission retries on a failure before
129     ;; reporting a loss back to the application.
130     (cmd-set-tx-retries invocation-handle retries)
131
132    )
133
134   (:incoming
135
136     (response-gmac-initialized invocation-handle status)
137
138     (response-carrier-sense-enable invocation-handle status)
139     (response-carrier-sense-threshold invocation-handle status)
140     (response-carrier-sense-deadline invocation-handle status)
141     (response-carrier-sense-disable invocation-handle status)
142
143     (response-set-tx-retries invocation-handle status)
144
145    )
146   )