linux/drivers/net/wireless/broadcom/b43legacy/dma.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef B43legacy_DMA_H_
#define B43legacy_DMA_H_

#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/workqueue.h>
#include <linux/linkage.h>
#include <linux/atomic.h>

#include "b43legacy.h"


/* DMA-Interrupt reasons. */
#define B43legacy_DMAIRQ_FATALMASK
#define B43legacy_DMAIRQ_NONFATALMASK
#define B43legacy_DMAIRQ_RX_DONE


/*** 32-bit DMA Engine. ***/

/* 32-bit DMA controller registers. */
#define B43legacy_DMA32_TXCTL
#define B43legacy_DMA32_TXENABLE
#define B43legacy_DMA32_TXSUSPEND
#define B43legacy_DMA32_TXLOOPBACK
#define B43legacy_DMA32_TXFLUSH
#define B43legacy_DMA32_TXADDREXT_MASK
#define B43legacy_DMA32_TXADDREXT_SHIFT
#define B43legacy_DMA32_TXRING
#define B43legacy_DMA32_TXINDEX
#define B43legacy_DMA32_TXSTATUS
#define B43legacy_DMA32_TXDPTR
#define B43legacy_DMA32_TXSTATE
#define B43legacy_DMA32_TXSTAT_DISABLED
#define B43legacy_DMA32_TXSTAT_ACTIVE
#define B43legacy_DMA32_TXSTAT_IDLEWAIT
#define B43legacy_DMA32_TXSTAT_STOPPED
#define B43legacy_DMA32_TXSTAT_SUSP
#define B43legacy_DMA32_TXERROR
#define B43legacy_DMA32_TXERR_NOERR
#define B43legacy_DMA32_TXERR_PROT
#define B43legacy_DMA32_TXERR_UNDERRUN
#define B43legacy_DMA32_TXERR_BUFREAD
#define B43legacy_DMA32_TXERR_DESCREAD
#define B43legacy_DMA32_TXACTIVE
#define B43legacy_DMA32_RXCTL
#define B43legacy_DMA32_RXENABLE
#define B43legacy_DMA32_RXFROFF_MASK
#define B43legacy_DMA32_RXFROFF_SHIFT
#define B43legacy_DMA32_RXDIRECTFIFO
#define B43legacy_DMA32_RXADDREXT_MASK
#define B43legacy_DMA32_RXADDREXT_SHIFT
#define B43legacy_DMA32_RXRING
#define B43legacy_DMA32_RXINDEX
#define B43legacy_DMA32_RXSTATUS
#define B43legacy_DMA32_RXDPTR
#define B43legacy_DMA32_RXSTATE
#define B43legacy_DMA32_RXSTAT_DISABLED
#define B43legacy_DMA32_RXSTAT_ACTIVE
#define B43legacy_DMA32_RXSTAT_IDLEWAIT
#define B43legacy_DMA32_RXSTAT_STOPPED
#define B43legacy_DMA32_RXERROR
#define B43legacy_DMA32_RXERR_NOERR
#define B43legacy_DMA32_RXERR_PROT
#define B43legacy_DMA32_RXERR_OVERFLOW
#define B43legacy_DMA32_RXERR_BUFWRITE
#define B43legacy_DMA32_RXERR_DESCREAD
#define B43legacy_DMA32_RXACTIVE

/* 32-bit DMA descriptor. */
struct b43legacy_dmadesc32 {} __packed;
#define B43legacy_DMA32_DCTL_BYTECNT
#define B43legacy_DMA32_DCTL_ADDREXT_MASK
#define B43legacy_DMA32_DCTL_ADDREXT_SHIFT
#define B43legacy_DMA32_DCTL_DTABLEEND
#define B43legacy_DMA32_DCTL_IRQ
#define B43legacy_DMA32_DCTL_FRAMEEND
#define B43legacy_DMA32_DCTL_FRAMESTART


/* Misc DMA constants */
#define B43legacy_DMA_RINGMEMSIZE
#define B43legacy_DMA0_RX_FRAMEOFFSET
#define B43legacy_DMA3_RX_FRAMEOFFSET


/* DMA engine tuning knobs */
#define B43legacy_TXRING_SLOTS
#define B43legacy_RXRING_SLOTS
#define B43legacy_DMA0_RX_BUFFERSIZE
#define B43legacy_DMA3_RX_BUFFERSIZE



#ifdef CONFIG_B43LEGACY_DMA


struct sk_buff;
struct b43legacy_private;
struct b43legacy_txstatus;


struct b43legacy_dmadesc_meta {};

enum b43legacy_dmatype {};

struct b43legacy_dmaring {};


static inline
u32 b43legacy_dma_read(struct b43legacy_dmaring *ring,
		       u16 offset)
{}

static inline
void b43legacy_dma_write(struct b43legacy_dmaring *ring,
			 u16 offset, u32 value)
{}


int b43legacy_dma_init(struct b43legacy_wldev *dev);
void b43legacy_dma_free(struct b43legacy_wldev *dev);

void b43legacy_dma_tx_suspend(struct b43legacy_wldev *dev);
void b43legacy_dma_tx_resume(struct b43legacy_wldev *dev);

int b43legacy_dma_tx(struct b43legacy_wldev *dev,
		     struct sk_buff *skb);
void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev,
				   const struct b43legacy_txstatus *status);

void b43legacy_dma_rx(struct b43legacy_dmaring *ring);

#else /* CONFIG_B43LEGACY_DMA */


static inline
int b43legacy_dma_init(struct b43legacy_wldev *dev)
{
	return 0;
}
static inline
void b43legacy_dma_free(struct b43legacy_wldev *dev)
{
}
static inline
int b43legacy_dma_tx(struct b43legacy_wldev *dev,
		     struct sk_buff *skb)
{
	return 0;
}
static inline
void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev,
				   const struct b43legacy_txstatus *status)
{
}
static inline
void b43legacy_dma_rx(struct b43legacy_dmaring *ring)
{
}
static inline
void b43legacy_dma_tx_suspend(struct b43legacy_wldev *dev)
{
}
static inline
void b43legacy_dma_tx_resume(struct b43legacy_wldev *dev)
{
}

#endif /* CONFIG_B43LEGACY_DMA */
#endif /* B43legacy_DMA_H_ */