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/bcmsdpcm.h
Views: 3959
/*1* Broadcom SDIO/PCMCIA2* Software-specific definitions shared between device and host side3*4* $Copyright Open 2005 Broadcom Corporation$5*6* $Id: bcmsdpcm.h 314495 2012-02-12 07:56:39Z $7*/89#ifndef _bcmsdpcm_h_10#define _bcmsdpcm_h_1112/*13* Software allocation of To SB Mailbox resources14*/1516/* intstatus bits */17#define I_SMB_NAK I_SMB_SW0 /* To SB Mailbox Frame NAK */18#define I_SMB_INT_ACK I_SMB_SW1 /* To SB Mailbox Host Interrupt ACK */19#define I_SMB_USE_OOB I_SMB_SW2 /* To SB Mailbox Use OOB Wakeup */20#define I_SMB_DEV_INT I_SMB_SW3 /* To SB Mailbox Miscellaneous Interrupt */2122#define I_TOSBMAIL (I_SMB_NAK | I_SMB_INT_ACK | I_SMB_USE_OOB | I_SMB_DEV_INT)2324/* tosbmailbox bits corresponding to intstatus bits */25#define SMB_NAK (1 << 0) /* To SB Mailbox Frame NAK */26#define SMB_INT_ACK (1 << 1) /* To SB Mailbox Host Interrupt ACK */27#define SMB_USE_OOB (1 << 2) /* To SB Mailbox Use OOB Wakeup */28#define SMB_DEV_INT (1 << 3) /* To SB Mailbox Miscellaneous Interrupt */29#define SMB_MASK 0x0000000f /* To SB Mailbox Mask */3031/* tosbmailboxdata */32#define SMB_DATA_VERSION_MASK 0x00ff0000 /* host protocol version (sent with F2 enable) */33#define SMB_DATA_VERSION_SHIFT 16 /* host protocol version (sent with F2 enable) */3435/*36* Software allocation of To Host Mailbox resources37*/3839/* intstatus bits */40#define I_HMB_FC_STATE I_HMB_SW0 /* To Host Mailbox Flow Control State */41#define I_HMB_FC_CHANGE I_HMB_SW1 /* To Host Mailbox Flow Control State Changed */42#define I_HMB_FRAME_IND I_HMB_SW2 /* To Host Mailbox Frame Indication */43#define I_HMB_HOST_INT I_HMB_SW3 /* To Host Mailbox Miscellaneous Interrupt */4445#define I_TOHOSTMAIL (I_HMB_FC_CHANGE | I_HMB_FRAME_IND | I_HMB_HOST_INT)4647/* tohostmailbox bits corresponding to intstatus bits */48#define HMB_FC_ON (1 << 0) /* To Host Mailbox Flow Control State */49#define HMB_FC_CHANGE (1 << 1) /* To Host Mailbox Flow Control State Changed */50#define HMB_FRAME_IND (1 << 2) /* To Host Mailbox Frame Indication */51#define HMB_HOST_INT (1 << 3) /* To Host Mailbox Miscellaneous Interrupt */52#define HMB_MASK 0x0000000f /* To Host Mailbox Mask */5354/* tohostmailboxdata */55#define HMB_DATA_NAKHANDLED 0x01 /* we're ready to retransmit NAK'd frame to host */56#define HMB_DATA_DEVREADY 0x02 /* we're ready to to talk to host after enable */57#define HMB_DATA_FC 0x04 /* per prio flowcontrol update flag to host */58#define HMB_DATA_FWREADY 0x08 /* firmware is ready for protocol activity */59#define HMB_DATA_FWHALT 0x10 /* firmware has halted operation */6061#define HMB_DATA_FCDATA_MASK 0xff000000 /* per prio flowcontrol data */62#define HMB_DATA_FCDATA_SHIFT 24 /* per prio flowcontrol data */6364#define HMB_DATA_VERSION_MASK 0x00ff0000 /* device protocol version (with devready) */65#define HMB_DATA_VERSION_SHIFT 16 /* device protocol version (with devready) */6667/*68* Software-defined protocol header69*/7071/* Current protocol version */72#define SDPCM_PROT_VERSION 47374/* SW frame header */75#define SDPCM_SEQUENCE_MASK 0x000000ff /* Sequence Number Mask */76#define SDPCM_PACKET_SEQUENCE(p) (((uint8 *)p)[0] & 0xff) /* p starts w/SW Header */7778#define SDPCM_CHANNEL_MASK 0x00000f00 /* Channel Number Mask */79#define SDPCM_CHANNEL_SHIFT 8 /* Channel Number Shift */80#define SDPCM_PACKET_CHANNEL(p) (((uint8 *)p)[1] & 0x0f) /* p starts w/SW Header */8182#define SDPCM_FLAGS_MASK 0x0000f000 /* Mask of flag bits */83#define SDPCM_FLAGS_SHIFT 12 /* Flag bits shift */84#define SDPCM_PACKET_FLAGS(p) ((((uint8 *)p)[1] & 0xf0) >> 4) /* p starts w/SW Header */8586/* Next Read Len: lookahead length of next frame, in 16-byte units (rounded up) */87#define SDPCM_NEXTLEN_MASK 0x00ff0000 /* Next Read Len Mask */88#define SDPCM_NEXTLEN_SHIFT 16 /* Next Read Len Shift */89#define SDPCM_NEXTLEN_VALUE(p) ((((uint8 *)p)[2] & 0xff) << 4) /* p starts w/SW Header */90#define SDPCM_NEXTLEN_OFFSET 29192/* Data Offset from SOF (HW Tag, SW Tag, Pad) */93#define SDPCM_DOFFSET_OFFSET 3 /* Data Offset */94#define SDPCM_DOFFSET_VALUE(p) (((uint8 *)p)[SDPCM_DOFFSET_OFFSET] & 0xff)95#define SDPCM_DOFFSET_MASK 0xff00000096#define SDPCM_DOFFSET_SHIFT 249798#define SDPCM_FCMASK_OFFSET 4 /* Flow control */99#define SDPCM_FCMASK_VALUE(p) (((uint8 *)p)[SDPCM_FCMASK_OFFSET ] & 0xff)100#define SDPCM_WINDOW_OFFSET 5 /* Credit based fc */101#define SDPCM_WINDOW_VALUE(p) (((uint8 *)p)[SDPCM_WINDOW_OFFSET] & 0xff)102#define SDPCM_VERSION_OFFSET 6 /* Version # */103#define SDPCM_VERSION_VALUE(p) (((uint8 *)p)[SDPCM_VERSION_OFFSET] & 0xff)104#define SDPCM_UNUSED_OFFSET 7 /* Spare */105#define SDPCM_UNUSED_VALUE(p) (((uint8 *)p)[SDPCM_UNUSED_OFFSET] & 0xff)106107#define SDPCM_SWHEADER_LEN 8 /* SW header is 64 bits */108109/* logical channel numbers */110#define SDPCM_CONTROL_CHANNEL 0 /* Control Request/Response Channel Id */111#define SDPCM_EVENT_CHANNEL 1 /* Asyc Event Indication Channel Id */112#define SDPCM_DATA_CHANNEL 2 /* Data Xmit/Recv Channel Id */113#define SDPCM_GLOM_CHANNEL 3 /* For coalesced packets (superframes) */114#define SDPCM_TEST_CHANNEL 15 /* Reserved for test/debug packets */115#define SDPCM_MAX_CHANNEL 15116117#define SDPCM_SEQUENCE_WRAP 256 /* wrap-around val for eight-bit frame seq number */118119#define SDPCM_FLAG_RESVD0 0x01120#define SDPCM_FLAG_RESVD1 0x02121#define SDPCM_FLAG_GSPI_TXENAB 0x04122#define SDPCM_FLAG_GLOMDESC 0x08 /* Superframe descriptor mask */123124/* For GLOM_CHANNEL frames, use a flag to indicate descriptor frame */125#define SDPCM_GLOMDESC_FLAG (SDPCM_FLAG_GLOMDESC << SDPCM_FLAGS_SHIFT)126127#define SDPCM_GLOMDESC(p) (((uint8 *)p)[1] & 0x80)128129/* For TEST_CHANNEL packets, define another 4-byte header */130#define SDPCM_TEST_HDRLEN 4 /* Generally: Cmd(1), Ext(1), Len(2);131* Semantics of Ext byte depend on command.132* Len is current or requested frame length, not133* including test header; sent little-endian.134*/135#define SDPCM_TEST_DISCARD 0x01 /* Receiver discards. Ext is a pattern id. */136#define SDPCM_TEST_ECHOREQ 0x02 /* Echo request. Ext is a pattern id. */137#define SDPCM_TEST_ECHORSP 0x03 /* Echo response. Ext is a pattern id. */138#define SDPCM_TEST_BURST 0x04 /* Receiver to send a burst. Ext is a frame count */139#define SDPCM_TEST_SEND 0x05 /* Receiver sets send mode. Ext is boolean on/off */140141/* Handy macro for filling in datagen packets with a pattern */142#define SDPCM_TEST_FILL(byteno, id) ((uint8)(id + byteno))143144/*145* Software counters (first part matches hardware counters)146*/147148typedef volatile struct {149uint32 cmd52rd; /* Cmd52RdCount, SDIO: cmd52 reads */150uint32 cmd52wr; /* Cmd52WrCount, SDIO: cmd52 writes */151uint32 cmd53rd; /* Cmd53RdCount, SDIO: cmd53 reads */152uint32 cmd53wr; /* Cmd53WrCount, SDIO: cmd53 writes */153uint32 abort; /* AbortCount, SDIO: aborts */154uint32 datacrcerror; /* DataCrcErrorCount, SDIO: frames w/CRC error */155uint32 rdoutofsync; /* RdOutOfSyncCount, SDIO/PCMCIA: Rd Frm out of sync */156uint32 wroutofsync; /* RdOutOfSyncCount, SDIO/PCMCIA: Wr Frm out of sync */157uint32 writebusy; /* WriteBusyCount, SDIO: device asserted "busy" */158uint32 readwait; /* ReadWaitCount, SDIO: no data ready for a read cmd */159uint32 readterm; /* ReadTermCount, SDIO: read frame termination cmds */160uint32 writeterm; /* WriteTermCount, SDIO: write frames termination cmds */161uint32 rxdescuflo; /* receive descriptor underflows */162uint32 rxfifooflo; /* receive fifo overflows */163uint32 txfifouflo; /* transmit fifo underflows */164uint32 runt; /* runt (too short) frames recv'd from bus */165uint32 badlen; /* frame's rxh len does not match its hw tag len */166uint32 badcksum; /* frame's hw tag chksum doesn't agree with len value */167uint32 seqbreak; /* break in sequence # space from one rx frame to the next */168uint32 rxfcrc; /* frame rx header indicates crc error */169uint32 rxfwoos; /* frame rx header indicates write out of sync */170uint32 rxfwft; /* frame rx header indicates write frame termination */171uint32 rxfabort; /* frame rx header indicates frame aborted */172uint32 woosint; /* write out of sync interrupt */173uint32 roosint; /* read out of sync interrupt */174uint32 rftermint; /* read frame terminate interrupt */175uint32 wftermint; /* write frame terminate interrupt */176} sdpcmd_cnt_t;177178/*179* Register Access Macros180*/181182#define SDIODREV_IS(var, val) ((var) == (val))183#define SDIODREV_GE(var, val) ((var) >= (val))184#define SDIODREV_GT(var, val) ((var) > (val))185#define SDIODREV_LT(var, val) ((var) < (val))186#define SDIODREV_LE(var, val) ((var) <= (val))187188#define SDIODDMAREG32(h, dir, chnl) \189((dir) == DMA_TX ? \190(void *)(uintptr)&((h)->regs->dma.sdiod32.dma32regs[chnl].xmt) : \191(void *)(uintptr)&((h)->regs->dma.sdiod32.dma32regs[chnl].rcv))192193#define SDIODDMAREG64(h, dir, chnl) \194((dir) == DMA_TX ? \195(void *)(uintptr)&((h)->regs->dma.sdiod64.dma64regs[chnl].xmt) : \196(void *)(uintptr)&((h)->regs->dma.sdiod64.dma64regs[chnl].rcv))197198#define SDIODDMAREG(h, dir, chnl) \199(SDIODREV_LT((h)->corerev, 1) ? \200SDIODDMAREG32((h), (dir), (chnl)) : \201SDIODDMAREG64((h), (dir), (chnl)))202203#define PCMDDMAREG(h, dir, chnl) \204((dir) == DMA_TX ? \205(void *)(uintptr)&((h)->regs->dma.pcm32.dmaregs.xmt) : \206(void *)(uintptr)&((h)->regs->dma.pcm32.dmaregs.rcv))207208#define SDPCMDMAREG(h, dir, chnl, coreid) \209((coreid) == SDIOD_CORE_ID ? \210SDIODDMAREG(h, dir, chnl) : \211PCMDDMAREG(h, dir, chnl))212213#define SDIODFIFOREG(h, corerev) \214(SDIODREV_LT((corerev), 1) ? \215((dma32diag_t *)(uintptr)&((h)->regs->dma.sdiod32.dmafifo)) : \216((dma32diag_t *)(uintptr)&((h)->regs->dma.sdiod64.dmafifo)))217218#define PCMDFIFOREG(h) \219((dma32diag_t *)(uintptr)&((h)->regs->dma.pcm32.dmafifo))220221#define SDPCMFIFOREG(h, coreid, corerev) \222((coreid) == SDIOD_CORE_ID ? \223SDIODFIFOREG(h, corerev) : \224PCMDFIFOREG(h))225226/*227* Shared structure between dongle and the host.228* The structure contains pointers to trap or assert information.229*/230#define SDPCM_SHARED_VERSION 0x0001231#define SDPCM_SHARED_VERSION_MASK 0x00FF232#define SDPCM_SHARED_ASSERT_BUILT 0x0100233#define SDPCM_SHARED_ASSERT 0x0200234#define SDPCM_SHARED_TRAP 0x0400235#define SDPCM_SHARED_IN_BRPT 0x0800236#define SDPCM_SHARED_SET_BRPT 0x1000237#define SDPCM_SHARED_PENDING_BRPT 0x2000238239typedef struct {240uint32 flags;241uint32 trap_addr;242uint32 assert_exp_addr;243uint32 assert_file_addr;244uint32 assert_line;245uint32 console_addr; /* Address of hndrte_cons_t */246uint32 msgtrace_addr;247uint32 fwid;248} sdpcm_shared_t;249250extern sdpcm_shared_t sdpcm_shared;251252/* Function can be used to notify host of FW halt */253extern void sdpcmd_fwhalt(void);254255#endif /* _bcmsdpcm_h_ */256257258