Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/next/external/cache/sources/wl/include/bcmspibrcm.h
Views: 3959
/*1* SD-SPI Protocol Conversion - BCMSDH->gSPI Translation Layer2*3* Copyright (C) 2013, Broadcom Corporation4* All Rights Reserved.5*6* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;7* the contents of this file may not be disclosed to third parties, copied8* or duplicated in any form, in whole or in part, without the prior9* written permission of Broadcom Corporation.10*11* $Id: bcmspibrcm.h 241182 2011-02-17 21:50:03Z $12*/13#ifndef _BCM_SPI_BRCM_H14#define _BCM_SPI_BRCM_H1516/* global msglevel for debug messages - bitvals come from sdiovar.h */1718#define sd_err(x)19#define sd_trace(x)20#define sd_info(x)21#define sd_debug(x)22#define sd_data(x)23#define sd_ctrl(x)2425#define sd_log(x)2627#define SDIOH_ASSERT(exp) \28do { if (!(exp)) \29printf("!!!ASSERT fail: file %s lines %d", __FILE__, __LINE__); \30} while (0)3132#define BLOCK_SIZE_F1 6433#define BLOCK_SIZE_F2 204834#define BLOCK_SIZE_F3 20483536/* internal return code */37#define SUCCESS 038#undef ERROR39#define ERROR 140#define ERROR_UF 241#define ERROR_OF 34243/* private bus modes */44#define SDIOH_MODE_SPI 04546#define USE_BLOCKMODE 0x2 /* Block mode can be single block or multi */47#define USE_MULTIBLOCK 0x44849struct sdioh_info {50uint cfg_bar; /* pci cfg address for bar */51uint32 caps; /* cached value of capabilities reg */52void *bar0; /* BAR0 for PCI Device */53osl_t *osh; /* osh handler */54void *controller; /* Pointer to SPI Controller's private data struct */5556uint lockcount; /* nest count of spi_lock() calls */57bool client_intr_enabled; /* interrupt connnected flag */58bool intr_handler_valid; /* client driver interrupt handler valid */59sdioh_cb_fn_t intr_handler; /* registered interrupt handler */60void *intr_handler_arg; /* argument to call interrupt handler */61bool initialized; /* card initialized */62uint32 target_dev; /* Target device ID */63uint32 intmask; /* Current active interrupts */64void *sdos_info; /* Pointer to per-OS private data */6566uint32 controller_type; /* Host controller type */67uint8 version; /* Host Controller Spec Compliance Version */68uint irq; /* Client irq */69uint32 intrcount; /* Client interrupts */70uint32 local_intrcount; /* Controller interrupts */71bool host_init_done; /* Controller initted */72bool card_init_done; /* Client SDIO interface initted */73bool polled_mode; /* polling for command completion */7475bool sd_use_dma; /* DMA on CMD53 */76bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */77/* Must be on for sd_multiblock to be effective */78bool use_client_ints; /* If this is false, make sure to restore */79/* polling hack in wl_linux.c:wl_timer() */80int adapter_slot; /* Maybe dealing with multiple slots/controllers */81int sd_mode; /* SD1/SD4/SPI */82int client_block_size[SPI_MAX_IOFUNCS]; /* Blocksize */83uint32 data_xfer_count; /* Current transfer */84uint16 card_rca; /* Current Address */85uint8 num_funcs; /* Supported funcs on client */86uint32 card_dstatus; /* 32bit device status */87uint32 com_cis_ptr;88uint32 func_cis_ptr[SPI_MAX_IOFUNCS];89void *dma_buf;90ulong dma_phys;91int r_cnt; /* rx count */92int t_cnt; /* tx_count */93uint32 wordlen; /* host processor 16/32bits */94uint32 prev_fun;95uint32 chip;96uint32 chiprev;97bool resp_delay_all;98bool dwordmode;99bool resp_delay_new;100101struct spierrstats_t spierrstats;102};103104/************************************************************105* Internal interfaces: per-port references into bcmspibrcm.c106*/107108/* Global message bits */109extern uint sd_msglevel;110111/**************************************************************112* Internal interfaces: bcmspibrcm.c references to per-port code113*/114115/* Interrupt (de)registration routines */116extern int spi_register_irq(sdioh_info_t *sd, uint irq);117extern void spi_free_irq(uint irq, sdioh_info_t *sd);118119/* OS-specific interrupt wrappers (atomic interrupt enable/disable) */120extern void spi_lock(sdioh_info_t *sd);121extern void spi_unlock(sdioh_info_t *sd);122123/* Allocate/init/free per-OS private data */124extern int spi_osinit(sdioh_info_t *sd);125extern void spi_osfree(sdioh_info_t *sd);126127#define SPI_RW_FLAG_M BITFIELD_MASK(1) /* Bit [31] - R/W Command Bit */128#define SPI_RW_FLAG_S 31129#define SPI_ACCESS_M BITFIELD_MASK(1) /* Bit [30] - Fixed/Incr Access */130#define SPI_ACCESS_S 30131#define SPI_FUNCTION_M BITFIELD_MASK(2) /* Bit [29:28] - Function Number */132#define SPI_FUNCTION_S 28133#define SPI_REG_ADDR_M BITFIELD_MASK(17) /* Bit [27:11] - Address */134#define SPI_REG_ADDR_S 11135#define SPI_LEN_M BITFIELD_MASK(11) /* Bit [10:0] - Packet length */136#define SPI_LEN_S 0137138#endif /* _BCM_SPI_BRCM_H */139140141