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/bcmsdh_fd.h
Views: 3960
/*1* BCMSDH Function Driver for SDIO-Linux2*3* Copyright (C) 1999-2012, Broadcom Corporation4*5* Unless you and Broadcom execute a separate written software license6* agreement governing use of this software, this software is licensed to you7* under the terms of the GNU General Public License version 2 (the "GPL"),8* available at http://www.broadcom.com/licenses/GPLv2.php, with the9* following added to such license:10*11* As a special exception, the copyright holders of this software give you12* permission to link this software with independent modules, and to copy and13* distribute the resulting executable under terms of your choice, provided that14* you also meet, for each linked independent module, the terms and conditions of15* the license of that module. An independent module is a module which is not16* derived from this software. The special exception does not apply to any17* modifications of the software.18*19* Notwithstanding the above, under no circumstances may you combine this20* software in any way with any other Broadcom software provided under a license21* other than the GPL, without Broadcom's express prior written consent.22*23* $Id: bcmsdh_fd.h 241182 2011-02-17 21:50:03Z gmo $24*/2526#ifndef __BCMSDH_FD_H__27#define __BCMSDH_FD_H__2829#ifdef BCMDBG30#define sd_err(x) do { if (sd_msglevel & SDH_ERROR_VAL) printf x; } while (0)31#define sd_trace(x) do { if (sd_msglevel & SDH_TRACE_VAL) printf x; } while (0)32#define sd_info(x) do { if (sd_msglevel & SDH_INFO_VAL) printf x; } while (0)33#define sd_debug(x) do { if (sd_msglevel & SDH_DEBUG_VAL) printf x; } while (0)34#define sd_data(x) do { if (sd_msglevel & SDH_DATA_VAL) printf x; } while (0)35#define sd_ctrl(x) do { if (sd_msglevel & SDH_CTRL_VAL) printf x; } while (0)36#else37#define sd_err(x)38#define sd_trace(x)39#define sd_info(x)40#define sd_debug(x)41#define sd_data(x)42#define sd_ctrl(x)43#endif4445#define sd_sync_dma(sd, read, nbytes)46#define sd_init_dma(sd)47#define sd_ack_intr(sd)48#define sd_wakeup(sd);49/* Allocate/init/free per-OS private data */50extern int sdiohfd_osinit(sdioh_info_t *sd);51extern void sdiohfd_osfree(sdioh_info_t *sd);5253#ifdef BCMPERFSTATS54#define sd_log(x) do { if (sd_msglevel & SDH_LOG_VAL) bcmlog x; } while (0)55#else56#define sd_log(x)57#endif5859#define SDIOH_ASSERT(exp) \60do { if (!(exp)) \61printf("!!!ASSERT fail: file %s lines %d", __FILE__, __LINE__); \62} while (0)6364#define BLOCK_SIZE_4318 6465#define BLOCK_SIZE_4328 5126667/* internal return code */68#define SUCCESS 069#define ERROR 17071/* private bus modes */72#define SDIOH_MODE_SD4 273#define CLIENT_INTR 0x100 /* Get rid of this! */74#define DMA_MAX_LEN (7*1024)7576struct sdioh_info {77osl_t *osh; /* osh handler */78bool client_intr_enabled; /* interrupt connnected flag */79bool intr_handler_valid; /* client driver interrupt handler valid */80sdioh_cb_fn_t intr_handler; /* registered interrupt handler */81void *intr_handler_arg; /* argument to call interrupt handler */82uint16 intmask; /* Current active interrupts */83void *sdos_info; /* Pointer to per-OS private data */8485uint irq; /* Client irq */86int intrcount; /* Client interrupts */8788bool sd_use_dma; /* DMA on CMD53 */89bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */90/* Must be on for sd_multiblock to be effective */91bool use_client_ints; /* If this is false, make sure to restore */92int sd_mode; /* SD1/SD4/SPI */93int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */94uint8 num_funcs; /* Supported funcs on client */95uint32 com_cis_ptr;96uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS];97uint max_dma_len;98uint max_dma_descriptors; /* DMA Descriptors supported by this controller. */99SDDMA_DESCRIPTOR SGList[32]; /* Scatter/Gather DMA List */100};101102/************************************************************103* Internal interfaces: per-port references into bcmsdiohfd.c104*/105106/* Global message bits */107extern uint sd_msglevel;108109/* OS-independent interrupt handler */110extern bool check_client_intr(sdioh_info_t *sd);111112/* Core interrupt enable/disable of device interrupts */113extern void sdiohfd_devintr_on(sdioh_info_t *sd);114extern void sdiohfd_devintr_off(sdioh_info_t *sd);115116117/**************************************************************118* Internal interfaces: bcmsdiohfd.c references to per-port code119*/120121/* Register mapping routines */122extern uint32 *sdiohfd_reg_map(osl_t *osh, int32 addr, int size);123extern void sdiohfd_reg_unmap(osl_t *osh, int32 addr, int size);124125/* Interrupt (de)registration routines */126extern int sdiohfd_register_irq(sdioh_info_t *sd, uint irq);127extern void sdiohfd_free_irq(uint irq, sdioh_info_t *sd);128129typedef struct _BCMSDH_FD_INSTANCE {130PSDDEVICE pDevice[3]; /* bus driver's device we are supporting */131sdioh_info_t *sd;132SDIO_STATUS LastRequestStatus; /* last request status */133} BCMSDH_FD_INSTANCE, *PBCMSDH_FD_INSTANCE;134135typedef struct _BCMSDH_FD_CONTEXT {136SDFUNCTION Function; /* function description for bus driver */137PBCMSDH_FD_INSTANCE pInstance;138SD_BUSCLOCK_RATE ClockOverride; /* clock rate override */139} BCMSDH_FD_CONTEXT, *PBCMSDH_FD_CONTEXT;140141/* prototypes */142SDIO_STATUS client_init(PBCMSDH_FD_CONTEXT pFuncContext,143PBCMSDH_FD_INSTANCE pInstance,144PSDDEVICE pDevice);145void client_detach(PBCMSDH_FD_CONTEXT pFuncContext,146PBCMSDH_FD_INSTANCE pInstance);147148#endif /* __BCMSDH_FD_H__ */149150151