The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/netif/acx/acxcmd.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 2006 The DragonFly Project.  All rights reserved.
    3  * 
    4  * This code is derived from software contributed to The DragonFly Project
    5  * by Sepherosa Ziehau <sepherosa@gmail.com>
    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  * 
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in
   15  *    the documentation and/or other materials provided with the
   16  *    distribution.
   17  * 3. Neither the name of The DragonFly Project nor the names of its
   18  *    contributors may be used to endorse or promote products derived
   19  *    from this software without specific, prior written permission.
   20  * 
   21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
   25  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   26  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
   27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
   29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   31  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   32  * SUCH DAMAGE.
   33  * 
   34  * $DragonFly: src/sys/dev/netif/acx/acxcmd.h,v 1.6 2007/02/17 07:05:53 sephe Exp $
   35  */
   36 
   37 #ifndef _ACXCMD_H
   38 #define _ACXCMD_H
   39 
   40 #include "_acxcmd.h"
   41 
   42 void    acx_init_cmd_reg(struct acx_softc *);
   43 
   44 int     acx_enable_txchan(struct acx_softc *, uint8_t);
   45 int     acx_enable_rxchan(struct acx_softc *, uint8_t);
   46 int     acx_init_radio(struct acx_softc *, uint32_t, uint32_t);
   47 int     acx_join_bss(struct acx_softc *, uint8_t,
   48                      struct ieee80211_node *, struct ieee80211_channel *);
   49 
   50 /*
   51  * Possible values for the second parameter of acx_join_bss()
   52  */
   53 #define ACX_MODE_ADHOC  0
   54 #define ACX_MODE_UNUSED 1
   55 #define ACX_MODE_STA    2
   56 #define ACX_MODE_AP     3
   57 
   58 /*
   59  * Do not use following functions directly
   60  */
   61 int     acx_get_conf(struct acx_softc *, uint16_t, void *, uint16_t);
   62 int     acx_set_conf(struct acx_softc *, uint16_t, void *, uint16_t);
   63 int     acx_set_tmplt(struct acx_softc *, uint16_t, void *, uint16_t);
   64 int     acx_exec_command(struct acx_softc *, uint16_t, void *, uint16_t,
   65                          void *, uint16_t);
   66 
   67 
   68 /*
   69  * NOTE:
   70  * Following structs' fields are little endian
   71  */
   72 
   73 struct acx_conf {
   74         uint16_t        conf_id;        /* see ACXCONF_ (_acxcmd.h) */
   75         uint16_t        conf_data_len;
   76 } __packed;
   77 
   78 struct acx_conf_mmap {
   79         struct acx_conf confcom;
   80         uint32_t        code_start;
   81         uint32_t        code_end;
   82         uint32_t        wep_cache_start;
   83         uint32_t        wep_cache_end;
   84         uint32_t        pkt_tmplt_start;
   85         uint32_t        pkt_tmplt_end;
   86         uint32_t        fw_desc_start;
   87         uint32_t        fw_desc_end;
   88         uint32_t        memblk_start;
   89         uint32_t        memblk_end;
   90 } __packed;
   91 
   92 struct acx_conf_wepopt {
   93         struct acx_conf confcom;
   94         uint16_t        nkey;
   95         uint8_t         opt;    /* see WEPOPT_ */
   96 } __packed;
   97 
   98 #define WEPOPT_HDWEP    0       /* hardware WEP */
   99 
  100 struct acx_conf_eaddr {
  101         struct acx_conf confcom;
  102         uint8_t         eaddr[IEEE80211_ADDR_LEN];
  103 } __packed;
  104 
  105 struct acx_conf_regdom {
  106         struct acx_conf confcom;
  107         uint8_t         regdom;
  108         uint8_t         unknown;
  109 } __packed;
  110 
  111 struct acx_conf_antenna {
  112         struct acx_conf confcom;
  113         uint8_t         antenna;
  114 } __packed;
  115 
  116 struct acx_conf_fwrev {
  117         struct acx_conf confcom;
  118 #define ACX_FWREV_LEN   20
  119         /*
  120          * "Rev xx.xx.xx.xx"
  121          * '\0' terminated
  122          */
  123         char            fw_rev[ACX_FWREV_LEN];
  124         uint32_t        hw_id;
  125 } __packed;
  126 
  127 struct acx_conf_nretry_long {
  128         struct acx_conf confcom;
  129         uint8_t         nretry;
  130 } __packed;
  131 
  132 struct acx_conf_nretry_short {
  133         struct acx_conf confcom;
  134         uint8_t         nretry;
  135 } __packed;
  136 
  137 struct acx_conf_msdu_lifetime {
  138         struct acx_conf confcom;
  139         uint32_t        lifetime;
  140 } __packed;
  141 
  142 struct acx_conf_rate_fallback {
  143         struct acx_conf confcom;
  144         uint8_t         ratefb_enable;  /* 0/1 */
  145 } __packed;
  146 
  147 struct acx_conf_rxopt {
  148         struct acx_conf confcom;
  149         uint16_t        opt1;   /* see RXOPT1_ */
  150         uint16_t        opt2;   /* see RXOPT2_ */
  151 } __packed;
  152 
  153 #define RXOPT1_INCL_RXBUF_HDR   0x2000  /* rxbuf with acx_rxbuf_hdr */
  154 #define RXOPT1_RECV_SSID        0x0400  /* recv frame for joined SSID */
  155 #define RXOPT1_FILT_BCAST       0x0200  /* filt broadcast pkt */
  156 #define RXOPT1_RECV_MCAST1      0x0100  /* recv pkt for multicast addr1 */
  157 #define RXOPT1_RECV_MCAST0      0x0080  /* recv pkt for multicast addr0 */
  158 #define RXOPT1_FILT_ALLMULTI    0x0040  /* filt allmulti pkt */
  159 #define RXOPT1_FILT_FSSID       0x0020  /* filt frame for foreign SSID */
  160 #define RXOPT1_FILT_FDEST       0x0010  /* filt frame for foreign dest addr */
  161 #define RXOPT1_PROMISC          0x0008  /* promisc mode */
  162 #define RXOPT1_INCL_FCS         0x0004
  163 #define RXOPT1_INCL_PHYHDR      0x0000  /* XXX 0x0002 */
  164 
  165 #define RXOPT2_RECV_ASSOC_REQ   0x0800
  166 #define RXOPT2_RECV_AUTH        0x0400
  167 #define RXOPT2_RECV_BEACON      0x0200
  168 #define RXOPT2_RECV_CF          0x0100
  169 #define RXOPT2_RECV_CTRL        0x0080
  170 #define RXOPT2_RECV_DATA        0x0040
  171 #define RXOPT2_RECV_BROKEN      0x0020  /* broken frame */
  172 #define RXOPT2_RECV_MGMT        0x0010
  173 #define RXOPT2_RECV_PROBE_REQ   0x0008
  174 #define RXOPT2_RECV_PROBE_RESP  0x0004
  175 #define RXOPT2_RECV_ACK         0x0002  /* RTS/CTS/ACK */
  176 #define RXOPT2_RECV_OTHER       0x0001
  177 
  178 struct acx_conf_wep_txkey {
  179         struct acx_conf confcom;
  180         uint8_t         wep_txkey;
  181 } __packed;
  182 
  183 
  184 struct acx_tmplt_null_data {
  185         uint16_t        size;
  186         struct ieee80211_frame data;
  187 } __packed;
  188 
  189 struct acx_tmplt_probe_req {
  190         uint16_t        size;
  191         union {
  192                 struct {
  193                         struct ieee80211_frame f;
  194                         uint8_t         var[1];
  195                 } __packed      u_data;
  196                 uint8_t         u_mem[0x44];
  197         }               data;
  198 } __packed;
  199 
  200 #define ACX_TMPLT_PROBE_REQ_SIZ(var_len)        \
  201         (sizeof(uint16_t) + sizeof(struct ieee80211_frame) + (var_len))
  202 
  203 struct acx_tmplt_probe_resp {
  204         uint16_t        size;
  205         union {
  206                 struct {
  207                         struct ieee80211_frame f;
  208                         uint8_t         time_stamp[8];
  209                         uint16_t        beacon_intvl;
  210                         uint16_t        cap;
  211                         uint8_t         var[1];
  212                 } __packed      u_data;
  213                 uint8_t         u_mem[0x100];
  214         }               data;
  215 } __packed;
  216 
  217 /* XXX same as acx_tmplt_probe_resp */
  218 struct acx_tmplt_beacon {
  219         uint16_t        size;
  220         union {
  221                 struct {
  222                         struct ieee80211_frame f;
  223                         uint8_t         time_stamp[8];
  224                         uint16_t        beacon_intvl;
  225                         uint16_t        cap;
  226                         uint8_t         var[1];
  227                 } __packed      u_data;
  228                 uint8_t         u_mem[0x100];
  229         }               data;
  230 } __packed;
  231 
  232 struct acx_tmplt_tim {
  233         uint16_t        size;
  234         union {
  235                 struct ieee80211_tim_ie u_tim;
  236                 uint8_t                 u_mem[0x100];
  237         }               data;
  238 } __packed;
  239 
  240 #define ACX_INIT_TMPLT_FUNC(name)                       \
  241 static __inline int                                     \
  242 acx_init_##name##_tmplt(struct acx_softc *_sc)          \
  243 {                                                       \
  244         struct acx_tmplt_##name _tmplt;                 \
  245                                                         \
  246         bzero(&_tmplt, sizeof(_tmplt));                 \
  247         return acx_set_tmplt(_sc, ACXCMD_TMPLT_##name,  \
  248                              &_tmplt, sizeof(_tmplt));  \
  249 }                                                       \
  250 struct __hack
  251 
  252 #define ACX_SET_TMPLT_FUNC(name)                        \
  253 static __inline int                                     \
  254 _acx_set_##name##_tmplt(struct acx_softc *_sc,          \
  255                        struct acx_tmplt_##name *_tmplt, \
  256                        uint16_t _tmplt_len)             \
  257 {                                                       \
  258         return acx_set_tmplt(_sc, ACXCMD_TMPLT_##name,  \
  259                              _tmplt, _tmplt_len);       \
  260 }                                                       \
  261 struct __hack
  262 
  263 #define _ACX_CONF_FUNC(sg, name, chip)                  \
  264 static __inline int                                     \
  265 acx##chip##_##sg##_##name##_conf(struct acx_softc *_sc, \
  266         struct acx##chip##_conf_##name *_conf)          \
  267 {                                                       \
  268         return acx_##sg##_conf(_sc, ACX_CONF_##name,    \
  269                                _conf, sizeof(*_conf));  \
  270 }                                                       \
  271 struct __hack
  272 
  273 #define ACX_NOARG_FUNC(name)                            \
  274 static __inline int                                     \
  275 acx_##name(struct acx_softc *_sc)                       \
  276 {                                                       \
  277         return acx_exec_command(_sc, ACXCMD_##name,     \
  278                                 NULL, 0, NULL, 0);      \
  279 }                                                       \
  280 struct __hack
  281 
  282 
  283 #define ACXCMD_TMPLT_tim        ACXCMD_TMPLT_TIM
  284 #define ACXCMD_TMPLT_beacon     ACXCMD_TMPLT_BEACON
  285 #define ACXCMD_TMPLT_probe_resp ACXCMD_TMPLT_PROBE_RESP
  286 #define ACXCMD_TMPLT_null_data  ACXCMD_TMPLT_NULL_DATA
  287 #define ACXCMD_TMPLT_probe_req  ACXCMD_TMPLT_PROBE_REQ
  288 ACX_INIT_TMPLT_FUNC(tim);
  289 ACX_INIT_TMPLT_FUNC(null_data);
  290 ACX_INIT_TMPLT_FUNC(beacon);
  291 ACX_INIT_TMPLT_FUNC(probe_req);
  292 ACX_INIT_TMPLT_FUNC(probe_resp);
  293 ACX_SET_TMPLT_FUNC(tim);
  294 ACX_SET_TMPLT_FUNC(null_data);
  295 ACX_SET_TMPLT_FUNC(beacon);
  296 ACX_SET_TMPLT_FUNC(probe_req);
  297 ACX_SET_TMPLT_FUNC(probe_resp);
  298 
  299 #define ACX_CONF_FUNC(sg, name) _ACX_CONF_FUNC(sg, name,)
  300 #define ACX_CONF_wepopt         ACX_CONF_WEPOPT
  301 #define ACX_CONF_mmap           ACX_CONF_MMAP
  302 #define ACX_CONF_eaddr          ACX_CONF_EADDR
  303 #define ACX_CONF_regdom         ACX_CONF_REGDOM
  304 #define ACX_CONF_antenna        ACX_CONF_ANTENNA
  305 #define ACX_CONF_fwrev          ACX_CONF_FWREV
  306 #define ACX_CONF_nretry_long    ACX_CONF_NRETRY_LONG
  307 #define ACX_CONF_nretry_short   ACX_CONF_NRETRY_SHORT
  308 #define ACX_CONF_msdu_lifetime  ACX_CONF_MSDU_LIFETIME
  309 #define ACX_CONF_rate_fallback  ACX_CONF_RATE_FALLBACK
  310 #define ACX_CONF_rxopt          ACX_CONF_RXOPT
  311 #define ACX_CONF_wep_txkey      ACX_CONF_WEP_TXKEY
  312 ACX_CONF_FUNC(get, mmap);
  313 ACX_CONF_FUNC(set, mmap);
  314 ACX_CONF_FUNC(set, wepopt);
  315 ACX_CONF_FUNC(get, eaddr);
  316 ACX_CONF_FUNC(get, regdom);
  317 ACX_CONF_FUNC(set, regdom);
  318 ACX_CONF_FUNC(get, antenna);
  319 ACX_CONF_FUNC(set, antenna);
  320 ACX_CONF_FUNC(get, fwrev);
  321 ACX_CONF_FUNC(set, nretry_long);
  322 ACX_CONF_FUNC(set, nretry_short);
  323 ACX_CONF_FUNC(set, msdu_lifetime);
  324 ACX_CONF_FUNC(set, rate_fallback);
  325 ACX_CONF_FUNC(set, rxopt);
  326 ACX_CONF_FUNC(set, wep_txkey);
  327 
  328 #define ACXCMD_sleep            ACXCMD_SLEEP
  329 #define ACXCMD_wakeup           ACXCMD_WAKEUP
  330 ACX_NOARG_FUNC(sleep);
  331 ACX_NOARG_FUNC(wakeup);
  332 
  333 #endif  /* !_ACXCMD_H */

Cache object: d2f4e66139a3883e96b475d821fb9fa5


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.