Deleted Added
full compact
athspectral.c (245231) athspectral.c (251737)
1/*
2 * Copyright (c) 2013 Adrian Chadd <adrian@FreeBSD.org>
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 *
1/*
2 * Copyright (c) 2013 Adrian Chadd <adrian@FreeBSD.org>
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 *
25 * $FreeBSD: head/tools/tools/ath/athspectral/athspectral.c 245231 2013-01-09 18:50:06Z adrian $
25 * $FreeBSD: head/tools/tools/ath/athspectral/athspectral.c 251737 2013-06-14 08:11:45Z adrian $
26 */
27
28#include "diag.h"
29
30#include "ah.h"
31#include "ah_internal.h"
32
33#ifndef ATH_DEFAULT

--- 28 unchanged lines hidden (view full) ---

62
63 strncpy(spectral->atd.ad_name, devid, sizeof (spectral->atd.ad_name));
64
65 /* Get the hardware revision, just to verify things are working */
66 spectral->atd.ad_id = HAL_DIAG_REVS;
67 spectral->atd.ad_out_data = (caddr_t) &revs;
68 spectral->atd.ad_out_size = sizeof(revs);
69 if (ioctl(spectral->s, SIOCGATHDIAG, &spectral->atd) < 0) {
26 */
27
28#include "diag.h"
29
30#include "ah.h"
31#include "ah_internal.h"
32
33#ifndef ATH_DEFAULT

--- 28 unchanged lines hidden (view full) ---

62
63 strncpy(spectral->atd.ad_name, devid, sizeof (spectral->atd.ad_name));
64
65 /* Get the hardware revision, just to verify things are working */
66 spectral->atd.ad_id = HAL_DIAG_REVS;
67 spectral->atd.ad_out_data = (caddr_t) &revs;
68 spectral->atd.ad_out_size = sizeof(revs);
69 if (ioctl(spectral->s, SIOCGATHDIAG, &spectral->atd) < 0) {
70 warn(spectral->atd.ad_name);
70 warn("%s", spectral->atd.ad_name);
71 return 0;
72 }
73 spectral->ah_devid = revs.ah_devid;
74 return 1;
75}
76
77void
78spectral_closedev(struct spectralhandler *spectral)

--- 32 unchanged lines hidden (view full) ---

111 }
112
113 spectral->atd.ad_id = SPECTRAL_CONTROL_SET_PARAMS | ATH_DIAG_IN;
114 spectral->atd.ad_out_data = NULL;
115 spectral->atd.ad_out_size = 0;
116 spectral->atd.ad_in_data = (caddr_t) &pe;
117 spectral->atd.ad_in_size = sizeof(HAL_SPECTRAL_PARAM);
118 if (ioctl(spectral->s, SIOCGATHSPECTRAL, &spectral->atd) < 0)
71 return 0;
72 }
73 spectral->ah_devid = revs.ah_devid;
74 return 1;
75}
76
77void
78spectral_closedev(struct spectralhandler *spectral)

--- 32 unchanged lines hidden (view full) ---

111 }
112
113 spectral->atd.ad_id = SPECTRAL_CONTROL_SET_PARAMS | ATH_DIAG_IN;
114 spectral->atd.ad_out_data = NULL;
115 spectral->atd.ad_out_size = 0;
116 spectral->atd.ad_in_data = (caddr_t) &pe;
117 spectral->atd.ad_in_size = sizeof(HAL_SPECTRAL_PARAM);
118 if (ioctl(spectral->s, SIOCGATHSPECTRAL, &spectral->atd) < 0)
119 err(1, spectral->atd.ad_name);
119 err(1, "%s", spectral->atd.ad_name);
120}
121
122static void
123spectral_get(struct spectralhandler *spectral)
124{
125 HAL_SPECTRAL_PARAM pe;
126
127 spectral->atd.ad_id = SPECTRAL_CONTROL_GET_PARAMS | ATH_DIAG_DYN;
128 memset(&pe, 0, sizeof(pe));
129
130 spectral->atd.ad_in_data = NULL;
131 spectral->atd.ad_in_size = 0;
132 spectral->atd.ad_out_data = (caddr_t) &pe;
133 spectral->atd.ad_out_size = sizeof(pe);
134
135 if (ioctl(spectral->s, SIOCGATHSPECTRAL, &spectral->atd) < 0)
120}
121
122static void
123spectral_get(struct spectralhandler *spectral)
124{
125 HAL_SPECTRAL_PARAM pe;
126
127 spectral->atd.ad_id = SPECTRAL_CONTROL_GET_PARAMS | ATH_DIAG_DYN;
128 memset(&pe, 0, sizeof(pe));
129
130 spectral->atd.ad_in_data = NULL;
131 spectral->atd.ad_in_size = 0;
132 spectral->atd.ad_out_data = (caddr_t) &pe;
133 spectral->atd.ad_out_size = sizeof(pe);
134
135 if (ioctl(spectral->s, SIOCGATHSPECTRAL, &spectral->atd) < 0)
136 err(1, spectral->atd.ad_name);
136 err(1, "%s", spectral->atd.ad_name);
137
138 printf("Spectral parameters (raw):\n");
139 printf(" ss_enabled: %d\n", pe.ss_enabled);
140 printf(" ss_active: %d\n", pe.ss_active);
141 printf(" ss_count: %d\n", pe.ss_count);
142 printf(" ss_fft_period: %d\n", pe.ss_fft_period);
143 printf(" ss_period: %d\n", pe.ss_period);
144 printf(" ss_short_report: %d\n", pe.ss_short_report);

--- 13 unchanged lines hidden (view full) ---

158 * and debug
159 */
160 spectral->atd.ad_in_data = NULL;
161 spectral->atd.ad_in_size = 0;
162 spectral->atd.ad_out_data = (caddr_t) &pe;
163 spectral->atd.ad_out_size = sizeof(pe);
164
165 if (ioctl(spectral->s, SIOCGATHSPECTRAL, &spectral->atd) < 0)
137
138 printf("Spectral parameters (raw):\n");
139 printf(" ss_enabled: %d\n", pe.ss_enabled);
140 printf(" ss_active: %d\n", pe.ss_active);
141 printf(" ss_count: %d\n", pe.ss_count);
142 printf(" ss_fft_period: %d\n", pe.ss_fft_period);
143 printf(" ss_period: %d\n", pe.ss_period);
144 printf(" ss_short_report: %d\n", pe.ss_short_report);

--- 13 unchanged lines hidden (view full) ---

158 * and debug
159 */
160 spectral->atd.ad_in_data = NULL;
161 spectral->atd.ad_in_size = 0;
162 spectral->atd.ad_out_data = (caddr_t) &pe;
163 spectral->atd.ad_out_size = sizeof(pe);
164
165 if (ioctl(spectral->s, SIOCGATHSPECTRAL, &spectral->atd) < 0)
166 err(1, spectral->atd.ad_name);
166 err(1, "%s", spectral->atd.ad_name);
167}
168
169static void
170spectral_stop(struct spectralhandler *spectral)
171{
172 HAL_SPECTRAL_PARAM pe;
173
174 spectral->atd.ad_id = SPECTRAL_CONTROL_STOP | ATH_DIAG_DYN;

--- 4 unchanged lines hidden (view full) ---

179 * and debug
180 */
181 spectral->atd.ad_in_data = NULL;
182 spectral->atd.ad_in_size = 0;
183 spectral->atd.ad_out_data = (caddr_t) &pe;
184 spectral->atd.ad_out_size = sizeof(pe);
185
186 if (ioctl(spectral->s, SIOCGATHSPECTRAL, &spectral->atd) < 0)
167}
168
169static void
170spectral_stop(struct spectralhandler *spectral)
171{
172 HAL_SPECTRAL_PARAM pe;
173
174 spectral->atd.ad_id = SPECTRAL_CONTROL_STOP | ATH_DIAG_DYN;

--- 4 unchanged lines hidden (view full) ---

179 * and debug
180 */
181 spectral->atd.ad_in_data = NULL;
182 spectral->atd.ad_in_size = 0;
183 spectral->atd.ad_out_data = (caddr_t) &pe;
184 spectral->atd.ad_out_size = sizeof(pe);
185
186 if (ioctl(spectral->s, SIOCGATHSPECTRAL, &spectral->atd) < 0)
187 err(1, spectral->atd.ad_name);
187 err(1, "%s", spectral->atd.ad_name);
188}
189
190static void
191spectral_enable_at_reset(struct spectralhandler *spectral, int val)
192{
193 int v = val;
194
195 spectral->atd.ad_id = SPECTRAL_CONTROL_ENABLE_AT_RESET

--- 6 unchanged lines hidden (view full) ---

202 spectral->atd.ad_out_data = NULL;
203 spectral->atd.ad_out_size = 0;
204 spectral->atd.ad_in_data = (caddr_t) &v;
205 spectral->atd.ad_in_size = sizeof(v);
206
207 printf("%s: val=%d\n", __func__, v);
208
209 if (ioctl(spectral->s, SIOCGATHSPECTRAL, &spectral->atd) < 0)
188}
189
190static void
191spectral_enable_at_reset(struct spectralhandler *spectral, int val)
192{
193 int v = val;
194
195 spectral->atd.ad_id = SPECTRAL_CONTROL_ENABLE_AT_RESET

--- 6 unchanged lines hidden (view full) ---

202 spectral->atd.ad_out_data = NULL;
203 spectral->atd.ad_out_size = 0;
204 spectral->atd.ad_in_data = (caddr_t) &v;
205 spectral->atd.ad_in_size = sizeof(v);
206
207 printf("%s: val=%d\n", __func__, v);
208
209 if (ioctl(spectral->s, SIOCGATHSPECTRAL, &spectral->atd) < 0)
210 err(1, spectral->atd.ad_name);
210 err(1, "%s", spectral->atd.ad_name);
211}
212
213static int
214spectral_set_param(struct spectralhandler *spectral, const char *param,
215 const char *val)
216{
217 int v;
218

--- 135 unchanged lines hidden ---
211}
212
213static int
214spectral_set_param(struct spectralhandler *spectral, const char *param,
215 const char *val)
216{
217 int v;
218

--- 135 unchanged lines hidden ---