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/hnddma.h
Views: 3959
/*1* Generic Broadcom Home Networking Division (HND) DMA engine SW interface2* This supports the following chips: BCM42xx, 44xx, 47xx .3*4* $Copyright Open Broadcom Corporation$5*6* $Id: hnddma.h 365056 2012-10-26 12:00:34Z maheshd $7*/89#ifndef _hnddma_h_10#define _hnddma_h_1112#ifndef _hnddma_pub_13#define _hnddma_pub_14typedef const struct hnddma_pub hnddma_t;15#endif /* _hnddma_pub_ */1617/* range param for dma_getnexttxp() and dma_txreclaim */18typedef enum txd_range {19HNDDMA_RANGE_ALL = 1,20HNDDMA_RANGE_TRANSMITTED,21HNDDMA_RANGE_TRANSFERED22} txd_range_t;2324/* dma function type */25typedef void (*di_detach_t)(hnddma_t *dmah);26typedef bool (*di_txreset_t)(hnddma_t *dmah);27typedef bool (*di_rxreset_t)(hnddma_t *dmah);28typedef bool (*di_rxidle_t)(hnddma_t *dmah);29typedef void (*di_txinit_t)(hnddma_t *dmah);30typedef bool (*di_txenabled_t)(hnddma_t *dmah);31typedef void (*di_rxinit_t)(hnddma_t *dmah);32typedef void (*di_txsuspend_t)(hnddma_t *dmah);33typedef void (*di_txresume_t)(hnddma_t *dmah);34typedef bool (*di_txsuspended_t)(hnddma_t *dmah);35typedef bool (*di_txsuspendedidle_t)(hnddma_t *dmah);36#ifdef WL_MULTIQUEUE37typedef void (*di_txflush_t)(hnddma_t *dmah);38typedef void (*di_txflush_clear_t)(hnddma_t *dmah);39#endif /* WL_MULTIQUEUE */40typedef int (*di_txfast_t)(hnddma_t *dmah, void *p, bool commit);41typedef int (*di_txunframed_t)(hnddma_t *dmah, void *p, uint len, bool commit);42typedef void* (*di_getpos_t)(hnddma_t *di, bool direction);43typedef void (*di_fifoloopbackenable_t)(hnddma_t *dmah);44typedef bool (*di_txstopped_t)(hnddma_t *dmah);45typedef bool (*di_rxstopped_t)(hnddma_t *dmah);46typedef bool (*di_rxenable_t)(hnddma_t *dmah);47typedef bool (*di_rxenabled_t)(hnddma_t *dmah);48typedef void* (*di_rx_t)(hnddma_t *dmah);49typedef bool (*di_rxfill_t)(hnddma_t *dmah);50typedef void (*di_txreclaim_t)(hnddma_t *dmah, txd_range_t range);51typedef void (*di_rxreclaim_t)(hnddma_t *dmah);52typedef uintptr (*di_getvar_t)(hnddma_t *dmah, const char *name);53typedef void* (*di_getnexttxp_t)(hnddma_t *dmah, txd_range_t range);54typedef void* (*di_getnextrxp_t)(hnddma_t *dmah, bool forceall);55typedef void* (*di_peeknexttxp_t)(hnddma_t *dmah);56typedef void* (*di_peekntxp_t)(hnddma_t *dmah, int *len, void *txps[], txd_range_t range);57typedef void* (*di_peeknextrxp_t)(hnddma_t *dmah);58typedef void (*di_rxparam_get_t)(hnddma_t *dmah, uint16 *rxoffset, uint16 *rxbufsize);59typedef void (*di_txblock_t)(hnddma_t *dmah);60typedef void (*di_txunblock_t)(hnddma_t *dmah);61typedef uint (*di_txactive_t)(hnddma_t *dmah);62typedef void (*di_txrotate_t)(hnddma_t *dmah);63typedef void (*di_counterreset_t)(hnddma_t *dmah);64typedef uint (*di_ctrlflags_t)(hnddma_t *dmah, uint mask, uint flags);65typedef char* (*di_dump_t)(hnddma_t *dmah, struct bcmstrbuf *b, bool dumpring);66typedef char* (*di_dumptx_t)(hnddma_t *dmah, struct bcmstrbuf *b, bool dumpring);67typedef char* (*di_dumprx_t)(hnddma_t *dmah, struct bcmstrbuf *b, bool dumpring);68typedef uint (*di_rxactive_t)(hnddma_t *dmah);69typedef uint (*di_txpending_t)(hnddma_t *dmah);70typedef uint (*di_txcommitted_t)(hnddma_t *dmah);71typedef int (*di_pktpool_set_t)(hnddma_t *dmah, pktpool_t *pool);72typedef bool (*di_rxtxerror_t)(hnddma_t *dmah, bool istx);73typedef void (*di_burstlen_set_t)(hnddma_t *dmah, uint8 rxburstlen, uint8 txburstlen);74typedef uint (*di_avoidancecnt_t)(hnddma_t *dmah);75typedef uint (*dma_active_rxbuf_t) (hnddma_t *dmah);7677/* dma opsvec */78typedef struct di_fcn_s {79di_detach_t detach;80di_txinit_t txinit;81di_txreset_t txreset;82di_txenabled_t txenabled;83di_txsuspend_t txsuspend;84di_txresume_t txresume;85di_txsuspended_t txsuspended;86di_txsuspendedidle_t txsuspendedidle;87#ifdef WL_MULTIQUEUE88di_txflush_t txflush;89di_txflush_clear_t txflush_clear;90#endif /* WL_MULTIQUEUE */91di_txfast_t txfast;92di_txunframed_t txunframed;93di_getpos_t getpos;94di_txstopped_t txstopped;95di_txreclaim_t txreclaim;96di_getnexttxp_t getnexttxp;97di_peeknexttxp_t peeknexttxp;98di_peekntxp_t peekntxp;99di_txblock_t txblock;100di_txunblock_t txunblock;101di_txactive_t txactive;102di_txrotate_t txrotate;103104di_rxinit_t rxinit;105di_rxreset_t rxreset;106di_rxidle_t rxidle;107di_rxstopped_t rxstopped;108di_rxenable_t rxenable;109di_rxenabled_t rxenabled;110di_rx_t rx;111di_rxfill_t rxfill;112di_rxreclaim_t rxreclaim;113di_getnextrxp_t getnextrxp;114di_peeknextrxp_t peeknextrxp;115di_rxparam_get_t rxparam_get;116117di_fifoloopbackenable_t fifoloopbackenable;118di_getvar_t d_getvar;119di_counterreset_t counterreset;120di_ctrlflags_t ctrlflags;121di_dump_t dump;122di_dumptx_t dumptx;123di_dumprx_t dumprx;124di_rxactive_t rxactive;125di_txpending_t txpending;126di_txcommitted_t txcommitted;127di_pktpool_set_t pktpool_set;128di_rxtxerror_t rxtxerror;129di_burstlen_set_t burstlen_set;130di_avoidancecnt_t avoidancecnt;131#ifdef WL_RXBUFF_EARLY_RC132dma_active_rxbuf_t dma_activerxbuf;133#endif134uint endnum;135} di_fcn_t;136137/*138* Exported data structure (read-only)139*/140/* export structure */141struct hnddma_pub {142const di_fcn_t *di_fn; /* DMA function pointers */143uint txavail; /* # free tx descriptors */144uint dmactrlflags; /* dma control flags */145146/* rx error counters */147uint rxgiants; /* rx giant frames */148uint rxnobuf; /* rx out of dma descriptors */149/* tx error counters */150uint txnobuf; /* tx out of dma descriptors */151uint txnodesc; /* tx out of dma descriptors running count */152};153154155extern hnddma_t * dma_attach(osl_t *osh, const char *name, si_t *sih,156volatile void *dmaregstx, volatile void *dmaregsrx,157uint ntxd, uint nrxd, uint rxbufsize, int rxextheadroom, uint nrxpost,158uint rxoffset, uint *msg_level);159#ifdef BCMDMA32160161#define dma_detach(di) ((di)->di_fn->detach(di))162#define dma_txreset(di) ((di)->di_fn->txreset(di))163#define dma_rxreset(di) ((di)->di_fn->rxreset(di))164#define dma_rxidle(di) ((di)->di_fn->rxidle(di))165#define dma_txinit(di) ((di)->di_fn->txinit(di))166#define dma_txenabled(di) ((di)->di_fn->txenabled(di))167#define dma_rxinit(di) ((di)->di_fn->rxinit(di))168#define dma_txsuspend(di) ((di)->di_fn->txsuspend(di))169#define dma_txresume(di) ((di)->di_fn->txresume(di))170#define dma_txsuspended(di) ((di)->di_fn->txsuspended(di))171#define dma_txsuspendedidle(di) ((di)->di_fn->txsuspendedidle(di))172#ifdef WL_MULTIQUEUE173#define dma_txflush(di) ((di)->di_fn->txflush(di))174#define dma_txflush_clear(di) ((di)->di_fn->txflush_clear(di))175#endif /* WL_MULTIQUEUE */176#define dma_txfast(di, p, commit) ((di)->di_fn->txfast(di, p, commit))177#define dma_fifoloopbackenable(di) ((di)->di_fn->fifoloopbackenable(di))178#define dma_txstopped(di) ((di)->di_fn->txstopped(di))179#define dma_rxstopped(di) ((di)->di_fn->rxstopped(di))180#define dma_rxenable(di) ((di)->di_fn->rxenable(di))181#define dma_rxenabled(di) ((di)->di_fn->rxenabled(di))182#define dma_rx(di) ((di)->di_fn->rx(di))183#define dma_rxfill(di) ((di)->di_fn->rxfill(di))184#define dma_txreclaim(di, range) ((di)->di_fn->txreclaim(di, range))185#define dma_rxreclaim(di) ((di)->di_fn->rxreclaim(di))186#define dma_getvar(di, name) ((di)->di_fn->d_getvar(di, name))187#define dma_getnexttxp(di, range) ((di)->di_fn->getnexttxp(di, range))188#define dma_getnextrxp(di, forceall) ((di)->di_fn->getnextrxp(di, forceall))189#define dma_peeknexttxp(di) ((di)->di_fn->peeknexttxp(di))190#define dma_peekntxp(di, l, t, r) ((di)->di_fn->peekntxp(di, l, t, r))191#define dma_peeknextrxp(di) ((di)->di_fn->peeknextrxp(di))192#define dma_rxparam_get(di, off, bufs) ((di)->di_fn->rxparam_get(di, off, bufs))193194#define dma_txblock(di) ((di)->di_fn->txblock(di))195#define dma_txunblock(di) ((di)->di_fn->txunblock(di))196#define dma_txactive(di) ((di)->di_fn->txactive(di))197#define dma_rxactive(di) ((di)->di_fn->rxactive(di))198#define dma_txrotate(di) ((di)->di_fn->txrotate(di))199#define dma_counterreset(di) ((di)->di_fn->counterreset(di))200#define dma_ctrlflags(di, mask, flags) ((di)->di_fn->ctrlflags((di), (mask), (flags)))201#define dma_txpending(di) ((di)->di_fn->txpending(di))202#define dma_txcommitted(di) ((di)->di_fn->txcommitted(di))203#define dma_pktpool_set(di, pool) ((di)->di_fn->pktpool_set((di), (pool)))204#if defined(BCMDBG) || defined(BCMDBG_DUMP)205#define dma_dump(di, buf, dumpring) ((di)->di_fn->dump(di, buf, dumpring))206#define dma_dumptx(di, buf, dumpring) ((di)->di_fn->dumptx(di, buf, dumpring))207#define dma_dumprx(di, buf, dumpring) ((di)->di_fn->dumprx(di, buf, dumpring))208#endif /* defined(BCMDBG) || defined(BCMDBG_DUMP) */209#define dma_rxtxerror(di, istx) ((di)->di_fn->rxtxerror(di, istx))210#define dma_burstlen_set(di, rxlen, txlen) ((di)->di_fn->burstlen_set(di, rxlen, txlen))211#define dma_avoidance_cnt(di) ((di)->di_fn->avoidancecnt(di))212213#else /* BCMDMA32 */214extern const di_fcn_t dma64proc;215216#define dma_detach(di) (dma64proc.detach(di))217#define dma_txreset(di) (dma64proc.txreset(di))218#define dma_rxreset(di) (dma64proc.rxreset(di))219#define dma_rxidle(di) (dma64proc.rxidle(di))220#define dma_txinit(di) (dma64proc.txinit(di))221#define dma_txenabled(di) (dma64proc.txenabled(di))222#define dma_rxinit(di) (dma64proc.rxinit(di))223#define dma_txsuspend(di) (dma64proc.txsuspend(di))224#define dma_txresume(di) (dma64proc.txresume(di))225#define dma_txsuspended(di) (dma64proc.txsuspended(di))226#define dma_txsuspendedidle(di) (dma64proc.txsuspendedidle(di))227#ifdef WL_MULTIQUEUE228#define dma_txflush(di) (dma64proc.txflush(di))229#define dma_txflush_clear(di) (dma64proc.txflush_clear(di))230#endif /* WL_MULTIQUEUE */231#define dma_txfast(di, p, commit) (dma64proc.txfast(di, p, commit))232#define dma_txunframed(di, p, l, commit)(dma64proc.txunframed(di, p, l, commit))233#define dma_getpos(di, dir) (dma64proc.getpos(di, dir))234#define dma_fifoloopbackenable(di) (dma64proc.fifoloopbackenable(di))235#define dma_txstopped(di) (dma64proc.txstopped(di))236#define dma_rxstopped(di) (dma64proc.rxstopped(di))237#define dma_rxenable(di) (dma64proc.rxenable(di))238#define dma_rxenabled(di) (dma64proc.rxenabled(di))239#define dma_rx(di) (dma64proc.rx(di))240#define dma_rxfill(di) (dma64proc.rxfill(di))241#define dma_txreclaim(di, range) (dma64proc.txreclaim(di, range))242#define dma_rxreclaim(di) (dma64proc.rxreclaim(di))243#define dma_getvar(di, name) (dma64proc.d_getvar(di, name))244#define dma_getnexttxp(di, range) (dma64proc.getnexttxp(di, range))245#define dma_getnextrxp(di, forceall) (dma64proc.getnextrxp(di, forceall))246#define dma_peeknexttxp(di) (dma64proc.peeknexttxp(di))247#define dma_peekntxp(di, l, t, r) (dma64proc.peekntxp(di, l, t, r))248#define dma_peeknextrxp(di) (dma64proc.peeknextrxp(di))249#define dma_rxparam_get(di, off, bufs) (dma64proc.rxparam_get(di, off, bufs))250251#define dma_txblock(di) (dma64proc.txblock(di))252#define dma_txunblock(di) (dma64proc.txunblock(di))253#define dma_txactive(di) (dma64proc.txactive(di))254#define dma_rxactive(di) (dma64proc.rxactive(di))255#define dma_txrotate(di) (dma64proc.txrotate(di))256#define dma_counterreset(di) (dma64proc.counterreset(di))257#define dma_ctrlflags(di, mask, flags) (dma64proc.ctrlflags((di), (mask), (flags)))258#define dma_txpending(di) (dma64proc.txpending(di))259#define dma_txcommitted(di) (dma64proc.txcommitted(di))260#define dma_pktpool_set(di, pool) (dma64proc.pktpool_set((di), (pool)))261#if defined(BCMDBG) || defined(BCMDBG_DUMP)262#define dma_dump(di, buf, dumpring) (dma64proc.dump(di, buf, dumpring))263#define dma_dumptx(di, buf, dumpring) (dma64proc.dumptx(di, buf, dumpring))264#define dma_dumprx(di, buf, dumpring) (dma64proc.dumprx(di, buf, dumpring))265#endif266#define dma_rxtxerror(di, istx) (dma64proc.rxtxerror(di, istx))267#define dma_burstlen_set(di, rxlen, txlen) (dma64proc.burstlen_set(di, rxlen, txlen))268#define dma_avoidance_cnt(di) (dma64proc.avoidancecnt(di))269#define dma_activerxbuf(di) (dma64proc.dma_activerxbuf(di))270271#endif /* BCMDMA32 */272273/* return addresswidth allowed274* This needs to be done after SB attach but before dma attach.275* SB attach provides ability to probe backplane and dma core capabilities276* This info is needed by DMA_ALLOC_CONSISTENT in dma attach277*/278extern uint dma_addrwidth(si_t *sih, void *dmaregs);279280/* pio helpers */281extern void dma_txpioloopback(osl_t *osh, dma32regs_t *);282283#endif /* _hnddma_h_ */284285286