Home | History | Annotate | Download | only in include
      1 /*
      2  * CDC network driver ioctl/indication encoding
      3  * Broadcom 802.11abg Networking Device Driver
      4  *
      5  * Definitions subject to change without notice.
      6  *
      7  * Copyright (C) 1999-2011, Broadcom Corporation
      8  *
      9  * Permission to use, copy, modify, and/or distribute this software for any
     10  * purpose with or without fee is hereby granted, provided that the above
     11  * copyright notice and this permission notice appear in all copies.
     12  *
     13  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     14  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     15  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
     16  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     17  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
     18  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
     19  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     20  *
     21  * $Id: bcmcdc.h,v 13.25.10.3 2010-12-22 23:47:26 Exp $
     22  */
     23 
     24 #ifndef _bcmcdc_h_
     25 #define	_bcmcdc_h_
     26 #include <proto/ethernet.h>
     27 
     28 typedef struct cdc_ioctl {
     29 	uint32 cmd;
     30 	uint32 len;
     31 	uint32 flags;
     32 	uint32 status;
     33 } cdc_ioctl_t;
     34 
     35 
     36 #define CDC_MAX_MSG_SIZE   ETHER_MAX_LEN
     37 
     38 
     39 #define CDCL_IOC_OUTLEN_MASK   0x0000FFFF
     40 #define CDCL_IOC_OUTLEN_SHIFT  0
     41 #define CDCL_IOC_INLEN_MASK    0xFFFF0000
     42 #define CDCL_IOC_INLEN_SHIFT   16
     43 
     44 
     45 #define CDCF_IOC_ERROR		0x01
     46 #define CDCF_IOC_SET		0x02
     47 #define CDCF_IOC_OVL_IDX_MASK	0x3c
     48 #define CDCF_IOC_OVL_RSV	0x40
     49 #define CDCF_IOC_OVL		0x80
     50 #define CDCF_IOC_ACTION_MASK	0xfe
     51 #define CDCF_IOC_ACTION_SHIFT	1
     52 #define CDCF_IOC_IF_MASK	0xF000
     53 #define CDCF_IOC_IF_SHIFT	12
     54 #define CDCF_IOC_ID_MASK	0xFFFF0000
     55 #define CDCF_IOC_ID_SHIFT	16
     56 
     57 #define CDC_IOC_IF_IDX(flags)	(((flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT)
     58 #define CDC_IOC_ID(flags)	(((flags) & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT)
     59 
     60 #define CDC_GET_IF_IDX(hdr) \
     61 	((int)((((hdr)->flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT))
     62 #define CDC_SET_IF_IDX(hdr, idx) \
     63 	((hdr)->flags = (((hdr)->flags & ~CDCF_IOC_IF_MASK) | ((idx) << CDCF_IOC_IF_SHIFT)))
     64 
     65 
     66 
     67 #define	BDC_HEADER_LEN		4
     68 
     69 #define BDC_PROTO_VER_1		1
     70 #define BDC_PROTO_VER		2
     71 
     72 #define BDC_FLAG_VER_MASK	0xf0
     73 #define BDC_FLAG_VER_SHIFT	4
     74 
     75 #define BDC_FLAG__UNUSED	0x03
     76 #define BDC_FLAG_SUM_GOOD	0x04
     77 #define BDC_FLAG_SUM_NEEDED	0x08
     78 
     79 #define BDC_PRIORITY_MASK	0x7
     80 
     81 #define BDC_FLAG2_FC_FLAG	0x10
     82 
     83 #define BDC_PRIORITY_FC_SHIFT	4
     84 
     85 #define BDC_FLAG2_IF_MASK	0x0f
     86 #define BDC_FLAG2_IF_SHIFT	0
     87 #define BDC_FLAG2_PAD_MASK		0xf0
     88 #define BDC_FLAG_PAD_MASK		0x03
     89 #define BDC_FLAG2_PAD_SHIFT		2
     90 #define BDC_FLAG_PAD_SHIFT		0
     91 #define BDC_FLAG2_PAD_IDX		0x3c
     92 #define BDC_FLAG_PAD_IDX		0x03
     93 #define BDC_GET_PAD_LEN(hdr) \
     94 	((int)(((((hdr)->flags2) & BDC_FLAG2_PAD_MASK) >> BDC_FLAG2_PAD_SHIFT) | \
     95 	((((hdr)->flags) & BDC_FLAG_PAD_MASK) >> BDC_FLAG_PAD_SHIFT)))
     96 #define BDC_SET_PAD_LEN(hdr, idx) \
     97 	((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_PAD_MASK) | \
     98 	(((idx) & BDC_FLAG2_PAD_IDX) << BDC_FLAG2_PAD_SHIFT))); \
     99 	((hdr)->flags = (((hdr)->flags & ~BDC_FLAG_PAD_MASK) | \
    100 	(((idx) & BDC_FLAG_PAD_IDX) << BDC_FLAG_PAD_SHIFT)))
    101 
    102 #define BDC_GET_IF_IDX(hdr) \
    103 	((int)((((hdr)->flags2) & BDC_FLAG2_IF_MASK) >> BDC_FLAG2_IF_SHIFT))
    104 #define BDC_SET_IF_IDX(hdr, idx) \
    105 	((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_IF_MASK) | ((idx) << BDC_FLAG2_IF_SHIFT)))
    106 
    107 struct bdc_header {
    108 	uint8	flags;
    109 	uint8	priority;
    110 	uint8	flags2;
    111 	uint8	dataOffset;
    112 };
    113 
    114 #endif
    115