linux/drivers/net/ethernet/qualcomm/emac/emac-mac.h

/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 */

/* EMAC DMA HW engine uses three rings:
 * Tx:
 *   TPD: Transmit Packet Descriptor ring.
 * Rx:
 *   RFD: Receive Free Descriptor ring.
 *     Ring of descriptors with empty buffers to be filled by Rx HW.
 *   RRD: Receive Return Descriptor ring.
 *     Ring of descriptors with buffers filled with received data.
 */

#ifndef _EMAC_HW_H_
#define _EMAC_HW_H_

/* EMAC_CSR register offsets */
#define EMAC_EMAC_WRAPPER_CSR1
#define EMAC_EMAC_WRAPPER_CSR2
#define EMAC_EMAC_WRAPPER_TX_TS_LO
#define EMAC_EMAC_WRAPPER_TX_TS_HI
#define EMAC_EMAC_WRAPPER_TX_TS_INX

/* DMA Order Settings */
enum emac_dma_order {};

enum emac_dma_req_block {};

/* Returns the value of bits idx...idx+n_bits */
#define BITS_GET(val, lo, hi)
#define BITS_SET(val, lo, hi, new_val)

/* RRD (Receive Return Descriptor) */
struct emac_rrd {};

/* TPD (Transmit Packet Descriptor) */
struct emac_tpd {};

/* emac_ring_header represents a single, contiguous block of DMA space
 * mapped for the three descriptor rings (tpd, rfd, rrd)
 */
struct emac_ring_header {};

/* emac_buffer is wrapper around a pointer to a socket buffer
 * so a DMA handle can be stored along with the skb
 */
struct emac_buffer {};

/* receive free descriptor (rfd) ring */
struct emac_rfd_ring {};

/* Receive Return Desciptor (RRD) ring */
struct emac_rrd_ring {};

/* Rx queue */
struct emac_rx_queue {};

/* Transimit Packet Descriptor (tpd) ring */
struct emac_tpd_ring {};

/* Tx queue */
struct emac_tx_queue {};

struct emac_adapter;

int  emac_mac_up(struct emac_adapter *adpt);
void emac_mac_down(struct emac_adapter *adpt);
void emac_mac_reset(struct emac_adapter *adpt);
void emac_mac_stop(struct emac_adapter *adpt);
void emac_mac_mode_config(struct emac_adapter *adpt);
void emac_mac_rx_process(struct emac_adapter *adpt, struct emac_rx_queue *rx_q,
			 int *num_pkts, int max_pkts);
netdev_tx_t emac_mac_tx_buf_send(struct emac_adapter *adpt,
				 struct emac_tx_queue *tx_q,
				 struct sk_buff *skb);
void emac_mac_tx_process(struct emac_adapter *adpt, struct emac_tx_queue *tx_q);
void emac_mac_rx_tx_ring_init_all(struct platform_device *pdev,
				  struct emac_adapter *adpt);
int  emac_mac_rx_tx_rings_alloc_all(struct emac_adapter *adpt);
void emac_mac_rx_tx_rings_free_all(struct emac_adapter *adpt);
void emac_mac_multicast_addr_clear(struct emac_adapter *adpt);
void emac_mac_multicast_addr_set(struct emac_adapter *adpt, u8 *addr);

#endif /*_EMAC_HW_H_*/