summaryrefslogtreecommitdiff
path: root/usrp/host/apps-inband/gmac.mbh
blob: 4fa9a062fdb7e12ff37a666dd4f3d73e88cc9f58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
;; -*- scheme -*- ; not really, but tells emacs how to format this
;;
;; Copyright 2007 Free Software Foundation, Inc.
;; 
;; This file is part of GNU Radio
;; 
;; GNU Radio is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; 
;; GNU Radio is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;; 
;; You should have received a copy of the GNU General Public License along
;; with this program; if not, write to the Free Software Foundation, Inc.,
;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;;

;; ----------------------------------------------------------------
;;              This is an mblock header file
;;
;; The format is very much a work-in-progress.
;; It'll be compiled to C++.
;; ----------------------------------------------------------------

;; In the outgoing messages described below, invocation-handle is an
;; identifier provided by the client to tag the method invocation.
;; The identifier will be returned with the response, to provide the
;; client with a mechanism to match asynchronous responses with the
;; commands that generate them.  The value of the invocation-handle is
;; opaque the the server, and is not required by the server to be
;; unique.
;;
;; In the incoming messages described below, invocation-handle is the
;; identifier provided by the client in the prompting invocation.  The
;; identifier is returned with the response, so that the client has a
;; mechanism to match asynchronous responses with the commands that
;; generated them.
;;
;; status is either #t, indicating success, or a symbol indicating an error.
;; All symbol's names shall begin with %error-


;; ----------------------------------------------------------------
;; gmac-tx
;;
;; The protocol class is defined from the client's point-of-view.
;; (The client port is unconjugated, the server port is conjugated.)

(define-protocol-class gmac-tx

  (:outgoing

    ;; Transmitting packets can carry an invocation handle so the application
    ;; can get TX results on specific packets, such as whether a packet tagged
    ;; as #1 was successfully transmitted or not.  This would allow the
    ;; application to implement something sliding window like.
    ;;
    ;; 'dst' is the destination MAC address (given a MAC addressing scheme)
    ;;
    ;; 'data' will be treated transparently and passed on as samples.
    ;;
    ;; 'properties' can be used in the future to set per-packet options such as
    ;;   carrier sense overriding functionality.
    (cmd-tx-pkt invocation-handle dst data properties)

   )

  (:incoming

    ;; The response will carry the same invocation-handle passed with cmd-tx-pkt
    (response-tx-pkt invocation-handle status)

   )
  )

;; ----------------------------------------------------------------
;; gmac-rx
;;
;; The protocol class is defined from the client's point-of-view.
;; (The client port is unconjugated, the server port is conjugated.)

(define-protocol-class gmac-rx

  (:outgoing
    
    ;; There are currently no outgoing commands, I believe that the RX
    ;; should always be enabled, there is no point in having an enable/disable
    ;; that I can see.
   
   )

  (:incoming

    ;; Contains packets decoded by the MAC destined for this machine, sent by
    ;; the specified address.
    (response-rx-pkt invocation-handle src data)

   )
  )


;; ----------------------------------------------------------------
;; gmac-cs
;;
;; The protocol class is defined from the client's point-of-view.
;; (The client port is unconjugated, the server port is conjugated.)
;;
;; This defines a control/status interface to the MAC layer, for control over
;; functionality such as carrier sense and future functionality such as channel
;; hopping.


(define-protocol-class gmac-cs

  (:outgoing

    ;; Threshold represents the carrier sense threshold based on the digital
    ;; reading out of the DAC.  If the threshold is set to PMT_NIL then the
    ;; MAC will use averaging to determine an appropriate threshold.
    (cmd-carrier-sense-enable invocation-handle threshold deadline)
    (cmd-carrier-sense-threshold invocation-handle threshold)
    (cmd-carrier-sense-disable invocation-handle)

    ;; Setting the number of fast transmission retries on a failure before
    ;; reporting a loss back to the application.
    (cmd-set-tx-retries invocation-handle retries)

   )

  (:incoming

    (response-gmac-initialized invocation-handle status)

    (response-carrier-sense-enable invocation-handle status)
    (response-carrier-sense-threshold invocation-handle status)
    (response-carrier-sense-deadline invocation-handle status)
    (response-carrier-sense-disable invocation-handle status)

    (response-set-tx-retries invocation-handle status)

   )
  )