FreeBSD kernel ATH device code
if_ath_alq.h
Go to the documentation of this file.
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2012 Adrian Chadd
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer,
12 * without modification.
13 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
14 * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
15 * redistribution must be conditioned upon including a substantially
16 * similar Disclaimer requirement for further binary redistribution.
17 *
18 * NO WARRANTY
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
22 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
24 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
27 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29 * THE POSSIBILITY OF SUCH DAMAGES.
30 *
31 * $FreeBSD$
32 */
33#ifndef __IF_ATH_ALQ_H__
34#define __IF_ATH_ALQ_H__
35
36#define ATH_ALQ_INIT_STATE 1
40 uint32_t sc_phy_rev;
41 uint32_t sc_hal_magic;
42};
43
44#define ATH_ALQ_EDMA_TXSTATUS 2
45#define ATH_ALQ_EDMA_RXSTATUS 3
46#define ATH_ALQ_EDMA_TXDESC 4
47
48#define ATH_ALQ_TDMA_BEACON_STATE 5
50 uint64_t rx_tsf; /* RX TSF of beacon frame */
51 uint64_t beacon_tsf; /* TSF inside beacon frame */
52 uint64_t tsf64;
53 uint64_t nextslot_tsf;
54 uint32_t nextslot_tu;
55 uint32_t txtime;
56};
57
58#define ATH_ALQ_TDMA_TIMER_CONFIG 6
60 uint32_t tdma_slot;
61 uint32_t tdma_slotlen;
62 uint32_t tdma_slotcnt;
63 uint32_t tdma_bintval;
64 uint32_t tdma_guard;
66 uint32_t tdma_dbaprep;
67};
68
69#define ATH_ALQ_TDMA_SLOT_CALC 7
71 uint64_t nexttbtt;
72 uint64_t next_slot;
73 int32_t tsfdelta;
74 int32_t avg_plus;
75 int32_t avg_minus;
76};
77
78#define ATH_ALQ_TDMA_TSF_ADJUST 8
80 uint64_t tsf64_old;
81 uint64_t tsf64_new;
82 int32_t tsfdelta;
83};
84
85#define ATH_ALQ_TDMA_TIMER_SET 9
87 uint32_t bt_intval;
88 uint32_t bt_nexttbtt;
89 uint32_t bt_nextdba;
90 uint32_t bt_nextswba;
91 uint32_t bt_nextatim;
92 uint32_t bt_flags;
95};
96
97#define ATH_ALQ_INTR_STATUS 10
99 uint32_t intr_status;
100 uint32_t intr_state[8];
102};
103
104#define ATH_ALQ_MIB_COUNTERS 11
106 uint32_t valid;
107 uint32_t tx_busy;
108 uint32_t rx_busy;
109 uint32_t chan_busy;
111 uint32_t cycle_count;
112};
113
114#define ATH_ALQ_MISSED_BEACON 12
115#define ATH_ALQ_STUCK_BEACON 13
116#define ATH_ALQ_RESUME_BEACON 14
117
118#define ATH_ALQ_TX_FIFO_PUSH 15
120 uint32_t txq;
121 uint32_t nframes;
122 uint32_t fifo_depth;
123 uint32_t frame_cnt;
124};
125
126/*
127 * These will always be logged, regardless.
128 */
129#define ATH_ALQ_LOG_ALWAYS_MASK 0x00000001
130
131#define ATH_ALQ_FILENAME_LEN 128
132#define ATH_ALQ_DEVNAME_LEN 32
133
135 uint32_t sc_alq_debug; /* Debug flags to report */
136 struct alq * sc_alq_alq; /* alq state */
137 unsigned int sc_alq_qsize; /* queue size */
138 unsigned int sc_alq_numlost; /* number of "lost" entries */
143};
144
145/* 128 bytes in total */
146#define ATH_ALQ_PAYLOAD_LEN 112
147
149 uint64_t threadid;
150 uint32_t tstamp_sec;
151 uint32_t tstamp_usec;
152 uint16_t op;
153 uint16_t len; /* Length of (optional) payload */
154};
155
158 char payload[];
159};
160
161#ifdef _KERNEL
162static inline int
163if_ath_alq_checkdebug(struct if_ath_alq *alq, uint16_t op)
164{
165
167 & (1 << (op - 1)));
168}
169
170extern void if_ath_alq_init(struct if_ath_alq *alq, const char *devname);
171extern void if_ath_alq_setcfg(struct if_ath_alq *alq, uint32_t macVer,
172 uint32_t macRev, uint32_t phyRev, uint32_t halMagic);
173extern void if_ath_alq_tidyup(struct if_ath_alq *alq);
174extern int if_ath_alq_start(struct if_ath_alq *alq);
175extern int if_ath_alq_stop(struct if_ath_alq *alq);
176extern void if_ath_alq_post(struct if_ath_alq *alq, uint16_t op,
177 uint16_t len, const char *buf);
178
179/* XXX maybe doesn't belong here? */
180static inline void
181if_ath_alq_post_intr(struct if_ath_alq *alq, uint32_t status,
182 uint32_t *state, uint32_t sync_state)
183{
184 int i;
185 struct if_ath_alq_interrupt intr;
186
188 return;
189
190 intr.intr_status = htobe32(status);
191 for (i = 0; i < 8; i++)
192 intr.intr_state[i] = htobe32(state[i]);
193 intr.intr_syncstate = htobe32(sync_state);
194
195 if_ath_alq_post(alq, ATH_ALQ_INTR_STATUS, sizeof(intr),
196 (const char *) &intr);
197}
198
199#endif /* _KERNEL */
200
201#endif
#define ATH_ALQ_LOG_ALWAYS_MASK
Definition: if_ath_alq.h:129
#define ATH_ALQ_DEVNAME_LEN
Definition: if_ath_alq.h:132
void if_ath_alq_tidyup(struct if_ath_alq *alq)
void if_ath_alq_init(struct if_ath_alq *alq, const char *devname)
#define ATH_ALQ_FILENAME_LEN
Definition: if_ath_alq.h:131
void if_ath_alq_setcfg(struct if_ath_alq *alq, uint32_t macVer, uint32_t macRev, uint32_t phyRev, uint32_t halMagic)
int if_ath_alq_stop(struct if_ath_alq *alq)
static int if_ath_alq_checkdebug(struct if_ath_alq *alq, uint16_t op)
Definition: if_ath_alq.h:163
static void if_ath_alq_post_intr(struct if_ath_alq *alq, uint32_t status, uint32_t *state, uint32_t sync_state)
Definition: if_ath_alq.h:181
int if_ath_alq_start(struct if_ath_alq *alq)
void if_ath_alq_post(struct if_ath_alq *alq, uint16_t op, uint16_t len, const char *buf)
#define ATH_ALQ_INTR_STATUS
Definition: if_ath_alq.h:97
uint64_t threadid
Definition: if_ath_alq.h:149
uint16_t op
Definition: if_ath_alq.h:152
uint32_t tstamp_usec
Definition: if_ath_alq.h:151
uint32_t tstamp_sec
Definition: if_ath_alq.h:150
uint16_t len
Definition: if_ath_alq.h:153
uint32_t sc_mac_version
Definition: if_ath_alq.h:38
uint32_t sc_mac_revision
Definition: if_ath_alq.h:39
uint32_t intr_syncstate
Definition: if_ath_alq.h:101
uint32_t intr_state[8]
Definition: if_ath_alq.h:100
uint32_t intr_status
Definition: if_ath_alq.h:99
struct if_ath_alq_hdr hdr
Definition: if_ath_alq.h:157
int sc_alq_isactive
Definition: if_ath_alq.h:139
unsigned int sc_alq_numlost
Definition: if_ath_alq.h:138
char sc_alq_filename[ATH_ALQ_FILENAME_LEN]
Definition: if_ath_alq.h:141
unsigned int sc_alq_qsize
Definition: if_ath_alq.h:137
char sc_alq_devname[ATH_ALQ_DEVNAME_LEN]
Definition: if_ath_alq.h:140
uint32_t sc_alq_debug
Definition: if_ath_alq.h:135
struct if_ath_alq_init_state sc_alq_cfg
Definition: if_ath_alq.h:142
struct alq * sc_alq_alq
Definition: if_ath_alq.h:136