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

/* SPDX-License-Identifier: BSD-3-Clause-Clear */
/*
 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#ifndef ATH12K_HTC_H
#define ATH12K_HTC_H

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

struct ath12k_base;

#define HTC_HDR_ENDPOINTID
#define HTC_HDR_FLAGS
#define HTC_HDR_PAYLOADLEN
#define HTC_HDR_CONTROLBYTES0
#define HTC_HDR_CONTROLBYTES1
#define HTC_HDR_RESERVED

#define HTC_SVC_MSG_SERVICE_ID
#define HTC_SVC_MSG_CONNECTIONFLAGS
#define HTC_SVC_MSG_SERVICEMETALENGTH
#define HTC_READY_MSG_CREDITCOUNT
#define HTC_READY_MSG_CREDITSIZE
#define HTC_READY_MSG_MAXENDPOINTS

#define HTC_READY_EX_MSG_HTCVERSION
#define HTC_READY_EX_MSG_MAXMSGSPERHTCBUNDLE

#define HTC_SVC_RESP_MSG_SERVICEID
#define HTC_SVC_RESP_MSG_STATUS
#define HTC_SVC_RESP_MSG_ENDPOINTID
#define HTC_SVC_RESP_MSG_MAXMSGSIZE
#define HTC_SVC_RESP_MSG_SERVICEMETALENGTH

#define HTC_MSG_MESSAGEID
#define HTC_SETUP_COMPLETE_EX_MSG_SETUPFLAGS
#define HTC_SETUP_COMPLETE_EX_MSG_MAXMSGSPERBUNDLEDRECV
#define HTC_SETUP_COMPLETE_EX_MSG_RSVD0
#define HTC_SETUP_COMPLETE_EX_MSG_RSVD1
#define HTC_SETUP_COMPLETE_EX_MSG_RSVD2

enum ath12k_htc_tx_flags {};

enum ath12k_htc_rx_flags {};

struct ath12k_htc_hdr {} __packed __aligned();

enum ath12k_htc_msg_id {};

enum ath12k_htc_version {};

enum ath12k_htc_conn_flag_threshold_level {};

#define ATH12K_HTC_CONN_FLAGS_THRESHOLD_LEVEL_MASK
#define ATH12K_HTC_CONN_FLAGS_REDUCE_CREDIT_DRIBBLE
#define ATH12K_HTC_CONN_FLAGS_DISABLE_CREDIT_FLOW_CTRL
#define ATH12K_HTC_CONN_FLAGS_RECV_ALLOC

enum ath12k_htc_conn_svc_status {};

struct ath12k_htc_ready {} __packed;

struct ath12k_htc_ready_extended {} __packed;

struct ath12k_htc_conn_svc {} __packed;

struct ath12k_htc_conn_svc_resp {} __packed;

struct ath12k_htc_setup_complete_extended {} __packed;

struct ath12k_htc_msg {} __packed __aligned();

enum ath12k_htc_record_id {};

struct ath12k_htc_record_hdr {} __packed;

struct ath12k_htc_credit_report {} __packed;

struct ath12k_htc_record {} __packed __aligned();

/* HTC FRAME structure layout draft
 *
 * note: the trailer offset is dynamic depending
 * on payload length. this is only a struct layout draft
 *
 *=======================================================
 *
 *                 HTC HEADER
 *
 *=======================================================
 *                      |
 *      HTC message     |        payload
 *   (variable length)  |    (variable length)
 *=======================================================
 *
 *                  HTC Record
 *
 *=======================================================
 */

enum ath12k_htc_svc_gid {};

#define SVC

enum ath12k_htc_svc_id {};

#undef SVC

enum ath12k_htc_ep_id {};

struct ath12k_htc_ep_ops {};

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

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

#define ATH12K_NUM_CONTROL_TX_BUFFERS
#define ATH12K_HTC_MAX_LEN
#define ATH12K_HTC_MAX_CTRL_MSG_LEN
#define ATH12K_HTC_WAIT_TIMEOUT_HZ
#define ATH12K_HTC_CONTROL_BUFFER_SIZE
#define ATH12K_HTC_CONN_SVC_TIMEOUT_HZ
#define ATH12K_HTC_MAX_SERVICE_ALLOC_ENTRIES

struct ath12k_htc_ep {};

struct ath12k_htc_svc_tx_credits {};

struct ath12k_htc {};

int ath12k_htc_init(struct ath12k_base *ar);
int ath12k_htc_wait_target(struct ath12k_htc *htc);
int ath12k_htc_start(struct ath12k_htc *htc);
int ath12k_htc_connect_service(struct ath12k_htc *htc,
			       struct ath12k_htc_svc_conn_req  *conn_req,
			       struct ath12k_htc_svc_conn_resp *conn_resp);
int ath12k_htc_send(struct ath12k_htc *htc, enum ath12k_htc_ep_id eid,
		    struct sk_buff *packet);
struct sk_buff *ath12k_htc_alloc_skb(struct ath12k_base *ar, int size);
void ath12k_htc_rx_completion_handler(struct ath12k_base *ar,
				      struct sk_buff *skb);

#endif