/* SPDX-License-Identifier: ISC */ /* * Copyright (c) 2005-2011 Atheros Communications Inc. * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. * Copyright (c) 2018 The Linux Foundation. All rights reserved.
*/
#ifndef _CE_H_ #define _CE_H_
#include"hif.h"
#define CE_HTT_H2T_MSG_SRC_NENTRIES 8192
/* Descriptor rings must be aligned to this boundary */ #define CE_DESC_RING_ALIGN 8 #define CE_SEND_FLAG_GATHER 0x00010000
/* * Copy Engine support: low-level Target-side Copy Engine API. * This is a hardware access layer used by code that understands * how to use copy engines.
*/
struct ath10k_ce_ring { /* Number of entries in this ring; must be power of 2 */ unsignedint nentries; unsignedint nentries_mask;
/* * For dest ring, this is the next index to be processed * by software after it was/is received into. * * For src ring, this is the last descriptor that was sent * and completion processed by software. * * Regardless of src or dest ring, this is an invariant * (modulo ring size): * write index >= read index >= sw_index
*/ unsignedint sw_index; /* cached copy */ unsignedint write_index; /* * For src ring, this is the next index not yet processed by HW. * This is a cached copy of the real HW index (read index), used * for avoiding reading the HW index register more often than * necessary. * This extends the invariant: * write index >= read index >= hw_index >= sw_index * * For dest ring, this is currently unused.
*/ /* cached copy */ unsignedint hw_index;
/* Start of DMA-coherent area reserved for descriptors */ /* Host address space */ void *base_addr_owner_space_unaligned; /* CE address space */
dma_addr_t base_addr_ce_space_unaligned;
/* * Actual start of descriptors. * Aligned to descriptor-size boundary. * Points into reserved DMA-coherent area, above.
*/ /* Host address space */ void *base_addr_owner_space;
/* CE address space */
dma_addr_t base_addr_ce_space;
/* * Queue a source buffer to be sent to an anonymous destination buffer. * ce - which copy engine to use * buffer - address of buffer * nbytes - number of bytes to send * transfer_id - arbitrary ID; reflected to destination * flags - CE_SEND_FLAG_* values * Returns 0 on success; otherwise an error status. * * Note: If no flags are specified, use CE's default data swap mode. * * Implementation note: pushes 1 buffer to Source ring
*/ int ath10k_ce_send(struct ath10k_ce_pipe *ce_state, void *per_transfer_send_context,
dma_addr_t buffer, unsignedint nbytes, /* 14 bits */ unsignedint transfer_id, unsignedint flags);
int ath10k_ce_num_free_src_entries(struct ath10k_ce_pipe *pipe);
/*==================Recv=======================*/
int __ath10k_ce_rx_num_free_bufs(struct ath10k_ce_pipe *pipe); int ath10k_ce_rx_post_buf(struct ath10k_ce_pipe *pipe, void *ctx,
dma_addr_t paddr); void ath10k_ce_rx_update_write_idx(struct ath10k_ce_pipe *pipe, u32 nentries);
/* recv flags */ /* Data is byte-swapped */ #define CE_RECV_FLAG_SWAPPED 1
/* * Supply data for the next completed unprocessed receive descriptor. * Pops buffer from Dest ring.
*/ int ath10k_ce_completed_recv_next(struct ath10k_ce_pipe *ce_state, void **per_transfer_contextp, unsignedint *nbytesp); /* * Supply data for the next completed unprocessed send descriptor. * Pops 1 completed send buffer from Source ring.
*/ int ath10k_ce_completed_send_next(struct ath10k_ce_pipe *ce_state, void **per_transfer_contextp);
int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state, void **per_transfer_contextp);
int ath10k_ce_init_pipe(struct ath10k *ar, unsignedint ce_id, conststruct ce_attr *attr); void ath10k_ce_deinit_pipe(struct ath10k *ar, unsignedint ce_id); int ath10k_ce_alloc_pipe(struct ath10k *ar, int ce_id, conststruct ce_attr *attr); void ath10k_ce_free_pipe(struct ath10k *ar, int ce_id);
/*==================CE Engine Shutdown=======================*/ /* * Support clean shutdown by allowing the caller to revoke * receive buffers. Target DMA must be stopped before using * this API.
*/ int ath10k_ce_revoke_recv_next(struct ath10k_ce_pipe *ce_state, void **per_transfer_contextp,
dma_addr_t *bufferp);
int ath10k_ce_completed_recv_next_nolock(struct ath10k_ce_pipe *ce_state, void **per_transfer_contextp, unsignedint *nbytesp);
/* * Support clean shutdown by allowing the caller to cancel * pending sends. Target DMA must be stopped before using * this API.
*/ int ath10k_ce_cancel_send_next(struct ath10k_ce_pipe *ce_state, void **per_transfer_contextp,
dma_addr_t *bufferp, unsignedint *nbytesp, unsignedint *transfer_idp);
/* Ring arithmetic (modulus number of entries in ring, which is a pwr of 2). */ #define CE_RING_DELTA(nentries_mask, fromidx, toidx) \
(((int)(toidx) - (int)(fromidx)) & (nentries_mask))
/* * Configuration information for a Copy Engine pipe. * Passed from Host to Target during startup (one per CE). * * NOTE: Structure is shared between Host software and Target firmware!
*/ struct ce_pipe_config {
__le32 pipenum;
__le32 pipedir;
__le32 nentries;
__le32 nbytes_max;
__le32 flags;
__le32 reserved;
};
/* * Directions for interconnect pipe configuration. * These definitions may be used during configuration and are shared * between Host and Target. * * Pipe Directions are relative to the Host, so PIPEDIR_IN means * "coming IN over air through Target to Host" as with a WiFi Rx operation. * Conversely, PIPEDIR_OUT means "going OUT from Host through Target over air" * as with a WiFi Tx operation. This is somewhat awkward for the "middle-man" * Target since things that are "PIPEDIR_OUT" are coming IN to the Target * over the interconnect.
*/ #define PIPEDIR_NONE 0 #define PIPEDIR_IN 1 /* Target-->Host, WiFi Rx direction */ #define PIPEDIR_OUT 2 /* Host->Target, WiFi Tx direction */ #define PIPEDIR_INOUT 3 /* bidirectional */
/* Establish a mapping between a service/direction and a pipe. */ struct ce_service_to_pipe {
__le32 service_id;
__le32 pipedir;
__le32 pipenum;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.