Path: blob/main/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h
39566 views
/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2012 Oleksandr Tymoshenko <[email protected]>4* Copyright (c) 2013 Luiz Otavio O Souza <[email protected]>5* All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10* 1. Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15*16* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND17* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE18* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE19* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE20* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL21* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS22* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)23* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT24* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY25* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF26* SUCH DAMAGE.27*/2829#ifndef _BCM2835_BSCVAR_H30#define _BCM2835_BSCVAR_H3132struct iic_msg;3334struct bcm_bsc_softc {35device_t sc_dev;36device_t sc_iicbus;37struct mtx sc_mtx;38struct resource * sc_mem_res;39struct resource * sc_irq_res;40void * sc_intrhand;41struct iic_msg * sc_curmsg;42bus_space_tag_t sc_bst;43bus_space_handle_t sc_bsh;44int sc_debug;45uint16_t sc_replen;46uint16_t sc_totlen;47uint16_t sc_resid;48uint16_t sc_dlen;49uint8_t * sc_data;50uint8_t sc_flags;51};5253#define BCM_I2C_BUSY 0x0154#define BCM_I2C_READ 0x0255#define BCM_I2C_ERROR 0x0456#define BCM_I2C_DONE 0x085758#define BCM_BSC_WRITE(_sc, _off, _val) \59bus_space_write_4((_sc)->sc_bst, (_sc)->sc_bsh, _off, _val)60#define BCM_BSC_READ(_sc, _off) \61bus_space_read_4((_sc)->sc_bst, (_sc)->sc_bsh, _off)6263#define BCM_BSC_LOCK(_sc) \64mtx_lock(&(_sc)->sc_mtx)65#define BCM_BSC_UNLOCK(_sc) \66mtx_unlock(&(_sc)->sc_mtx)6768#endif /* _BCM2835_BSCVAR_H_ */697071