1191762Simp/* 2191762Simp * Copyright (c) 2007 The DragonFly Project. All rights reserved. 3191762Simp * 4191762Simp * This code is derived from software contributed to The DragonFly Project 5191762Simp * by Sepherosa Ziehau <sepherosa@gmail.com> 6191762Simp * 7191762Simp * Redistribution and use in source and binary forms, with or without 8191762Simp * modification, are permitted provided that the following conditions 9191762Simp * are met: 10191762Simp * 11191762Simp * 1. Redistributions of source code must retain the above copyright 12191762Simp * notice, this list of conditions and the following disclaimer. 13191762Simp * 2. Redistributions in binary form must reproduce the above copyright 14191762Simp * notice, this list of conditions and the following disclaimer in 15191762Simp * the documentation and/or other materials provided with the 16191762Simp * distribution. 17191762Simp * 3. Neither the name of The DragonFly Project nor the names of its 18191762Simp * contributors may be used to endorse or promote products derived 19191762Simp * from this software without specific, prior written permission. 20191762Simp * 21191762Simp * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22191762Simp * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23191762Simp * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24191762Simp * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25191762Simp * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26191762Simp * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, 27191762Simp * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28191762Simp * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 29191762Simp * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 30191762Simp * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 31191762Simp * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32191762Simp * SUCH DAMAGE. 33191762Simp * 34191762Simp * $DragonFly: src/sys/dev/netif/bwi/bwimac.h,v 1.2 2008/02/15 11:15:38 sephe Exp $ 35191762Simp * $FreeBSD: releng/11.0/sys/dev/bwi/bwimac.h 283639 2015-05-27 22:30:21Z glebius $ 36191762Simp */ 37191762Simp 38191762Simp#ifndef _BWI_MAC_H 39191762Simp#define _BWI_MAC_H 40191762Simp 41191762Simpint bwi_mac_attach(struct bwi_softc *, int, uint8_t); 42191762Simpint bwi_mac_lateattach(struct bwi_mac *); 43191762Simpvoid bwi_mac_detach(struct bwi_mac *); 44191762Simpint bwi_mac_init(struct bwi_mac *); 45191762Simpvoid bwi_mac_reset(struct bwi_mac *, int); 46191762Simpint bwi_mac_start(struct bwi_mac *); 47191762Simpint bwi_mac_stop(struct bwi_mac *); 48191762Simpvoid bwi_mac_shutdown(struct bwi_mac *); 49191762Simpvoid bwi_mac_updateslot(struct bwi_mac *, int); 50191762Simpvoid bwi_mac_set_promisc(struct bwi_mac *, int); 51191762Simp 52191762Simpvoid bwi_mac_calibrate_txpower(struct bwi_mac *, 53191762Simp enum bwi_txpwrcb_type); 54191762Simpvoid bwi_mac_set_tpctl_11bg(struct bwi_mac *, 55191762Simp const struct bwi_tpctl *); 56191762Simpvoid bwi_mac_init_tpctl_11bg(struct bwi_mac *); 57191762Simpvoid bwi_mac_dummy_xmit(struct bwi_mac *); 58191762Simpvoid bwi_mac_reset_hwkeys(struct bwi_mac *); 59191762Simpint bwi_mac_config_ps(struct bwi_mac *); 60283639Sglebiusint bwi_mac_fw_alloc(struct bwi_mac *); 61191762Simp 62191762Simpuint16_t bwi_memobj_read_2(struct bwi_mac *, uint16_t, uint16_t); 63191762Simpuint32_t bwi_memobj_read_4(struct bwi_mac *, uint16_t, uint16_t); 64191762Simpvoid bwi_memobj_write_2(struct bwi_mac *, uint16_t, uint16_t, 65191762Simp uint16_t); 66191762Simpvoid bwi_memobj_write_4(struct bwi_mac *, uint16_t, uint16_t, 67191762Simp uint32_t); 68191762Simpvoid bwi_tmplt_write_4(struct bwi_mac *, uint32_t, uint32_t); 69191762Simpvoid bwi_hostflags_write(struct bwi_mac *, uint64_t); 70191762Simpuint64_t bwi_hostflags_read(struct bwi_mac *); 71191762Simp 72191762Simp#define MOBJ_WRITE_2(mac, objid, ofs, val) \ 73191762Simp bwi_memobj_write_2((mac), (objid), (ofs), (val)) 74191762Simp#define MOBJ_WRITE_4(mac, objid, ofs, val) \ 75191762Simp bwi_memobj_write_4((mac), (objid), (ofs), (val)) 76191762Simp#define MOBJ_READ_2(mac, objid, ofs) \ 77191762Simp bwi_memobj_read_2((mac), (objid), (ofs)) 78191762Simp#define MOBJ_READ_4(mac, objid, ofs) \ 79191762Simp bwi_memobj_read_4((mac), (objid), (ofs)) 80191762Simp 81191762Simp#define MOBJ_SETBITS_4(mac, objid, ofs, bits) \ 82191762Simp MOBJ_WRITE_4((mac), (objid), (ofs), \ 83191762Simp MOBJ_READ_4((mac), (objid), (ofs)) | (bits)) 84191762Simp#define MOBJ_CLRBITS_4(mac, objid, ofs, bits) \ 85191762Simp MOBJ_WRITE_4((mac), (objid), (ofs), \ 86191762Simp MOBJ_READ_4((mac), (objid), (ofs)) & ~(bits)) 87191762Simp 88191762Simp#define MOBJ_FILT_SETBITS_2(mac, objid, ofs, filt, bits) \ 89191762Simp MOBJ_WRITE_2((mac), (objid), (ofs), \ 90191762Simp (MOBJ_READ_2((mac), (objid), (ofs)) & (filt)) | (bits)) 91191762Simp 92191762Simp#define TMPLT_WRITE_4(mac, ofs, val) bwi_tmplt_write_4((mac), (ofs), (val)) 93191762Simp 94191762Simp#define HFLAGS_WRITE(mac, flags) bwi_hostflags_write((mac), (flags)) 95191762Simp#define HFLAGS_READ(mac) bwi_hostflags_read((mac)) 96191762Simp#define HFLAGS_CLRBITS(mac, bits) \ 97191762Simp HFLAGS_WRITE((mac), HFLAGS_READ((mac)) | (bits)) 98191762Simp#define HFLAGS_SETBITS(mac, bits) \ 99191762Simp HFLAGS_WRITE((mac), HFLAGS_READ((mac)) & ~(bits)) 100191762Simp 101191762Simp#endif /* !_BWI_MAC_H */ 102