linux/drivers/net/wireless/ath/ath10k/htc.h

/* SPDX-License-Identifier: ISC */
/*
 * Copyright (c) 2005-2011 Atheros Communications Inc.
 * Copyright (c) 2011-2016 Qualcomm Atheros, Inc.
 */

#ifndef _HTC_H_
#define _HTC_H_

#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/bug.h>
#include <linux/skbuff.h>
#include <linux/timer.h>
#include <linux/bitfield.h>

struct ath10k;

/****************/
/* HTC protocol */
/****************/

/*
 * HTC - host-target control protocol
 *
 * tx packets are generally <htc_hdr><payload>
 * rx packets are more complex: <htc_hdr><payload><trailer>
 *
 * The payload + trailer length is stored in len.
 * To get payload-only length one needs to payload - trailer_len.
 *
 * Trailer contains (possibly) multiple <htc_record>.
 * Each record is a id-len-value.
 *
 * HTC header flags, control_byte0, control_byte1
 * have different meaning depending whether its tx
 * or rx.
 *
 * Alignment: htc_hdr, payload and trailer are
 * 4-byte aligned.
 */

#define HTC_HOST_MAX_MSG_PER_RX_BUNDLE

enum ath10k_htc_tx_flags {};

enum ath10k_htc_rx_flags {};

#define ATH10K_HTC_FLAG_BUNDLE_MASK

/* bits 2-3 are for extra bundle count bits 4-5 */
#define ATH10K_HTC_BUNDLE_EXTRA_MASK
#define ATH10K_HTC_BUNDLE_EXTRA_SHIFT

static inline unsigned int ath10k_htc_get_bundle_count(u8 max_msgs, u8 flags)
{}

struct ath10k_htc_hdr {} __packed __aligned();

enum ath10k_ath10k_htc_msg_id {};

enum ath10k_htc_version {};

enum ath10k_htc_conn_flags {};

#define ATH10K_HTC_MSG_READY_EXT_ALT_DATA_MASK

enum ath10k_htc_conn_svc_status {};

#define ATH10K_MAX_MSG_PER_HTC_TX_BUNDLE
#define ATH10K_MIN_MSG_PER_HTC_TX_BUNDLE
#define ATH10K_MIN_CREDIT_PER_HTC_TX_BUNDLE

enum ath10k_htc_setup_complete_flags {};

struct ath10k_ath10k_htc_msg_hdr {} __packed;

struct ath10k_htc_unknown {} __packed;

struct ath10k_htc_ready {} __packed;

struct ath10k_htc_ready_extended {} __packed;

struct ath10k_htc_conn_svc {} __packed;

struct ath10k_htc_conn_svc_response {} __packed;

struct ath10k_htc_setup_complete_extended {} __packed;

struct ath10k_htc_msg {} __packed __aligned();

enum ath10k_ath10k_htc_record_id {};

struct ath10k_ath10k_htc_record_hdr {} __packed;

struct ath10k_htc_credit_report {} __packed;

struct ath10k_htc_lookahead_report {} __packed;

struct ath10k_htc_lookahead_bundle {} __packed;

struct ath10k_htc_record {} __packed __aligned();

/*******************/
/* Host-side stuff */
/*******************/

enum ath10k_htc_svc_gid {};

#define SVC

enum ath10k_htc_svc_id {};

#undef SVC

enum ath10k_htc_ep_id {};

struct ath10k_htc_ops {};

struct ath10k_htc_ep_ops {};

/* service connection information */
struct ath10k_htc_svc_conn_req {};

/* service connection response information */
struct ath10k_htc_svc_conn_resp {};

#define ATH10K_NUM_CONTROL_TX_BUFFERS
#define ATH10K_HTC_MAX_LEN
#define ATH10K_HTC_MAX_CTRL_MSG_LEN
#define ATH10K_HTC_WAIT_TIMEOUT_HZ
#define ATH10K_HTC_CONTROL_BUFFER_SIZE
#define ATH10K_HTC_CONN_SVC_TIMEOUT_HZ

struct ath10k_htc_ep {};

struct ath10k_htc_svc_tx_credits {};

struct ath10k_htc {};

int ath10k_htc_init(struct ath10k *ar);
int ath10k_htc_wait_target(struct ath10k_htc *htc);
void ath10k_htc_setup_tx_req(struct ath10k_htc_ep *ep);
int ath10k_htc_start(struct ath10k_htc *htc);
int ath10k_htc_connect_service(struct ath10k_htc *htc,
			       struct ath10k_htc_svc_conn_req  *conn_req,
			       struct ath10k_htc_svc_conn_resp *conn_resp);
void ath10k_htc_change_tx_credit_flow(struct ath10k_htc *htc,
				      enum ath10k_htc_ep_id eid,
				      bool enable);
int ath10k_htc_send(struct ath10k_htc *htc, enum ath10k_htc_ep_id eid,
		    struct sk_buff *packet);
void ath10k_htc_stop_hl(struct ath10k *ar);

int ath10k_htc_send_hl(struct ath10k_htc *htc, enum ath10k_htc_ep_id eid,
		       struct sk_buff *packet);
struct sk_buff *ath10k_htc_alloc_skb(struct ath10k *ar, int size);
void ath10k_htc_tx_completion_handler(struct ath10k *ar, struct sk_buff *skb);
void ath10k_htc_rx_completion_handler(struct ath10k *ar, struct sk_buff *skb);
void ath10k_htc_notify_tx_completion(struct ath10k_htc_ep *ep,
				     struct sk_buff *skb);
int ath10k_htc_process_trailer(struct ath10k_htc *htc,
			       u8 *buffer,
			       int length,
			       enum ath10k_htc_ep_id src_eid,
			       void *next_lookaheads,
			       int *next_lookaheads_len);

#endif