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

/*
 * Copyright (c) 2004-2011 Atheros Communications Inc.
 * Copyright (c) 2011 Qualcomm Atheros, Inc.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef HTC_H
#define HTC_H

#include "common.h"

/* frame header flags */

/* send direction */
#define HTC_FLAGS_NEED_CREDIT_UPDATE
#define HTC_FLAGS_SEND_BUNDLE
#define HTC_FLAGS_TX_FIXUP_NETBUF

/* receive direction */
#define HTC_FLG_RX_UNUSED
#define HTC_FLG_RX_TRAILER
/* Bundle count maske and shift */
#define HTC_FLG_RX_BNDL_CNT
#define HTC_FLG_RX_BNDL_CNT_S

#define HTC_HDR_LENGTH
#define HTC_MAX_PAYLOAD_LENGTH

/* HTC control message IDs */

#define HTC_MSG_READY_ID
#define HTC_MSG_CONN_SVC_ID
#define HTC_MSG_CONN_SVC_RESP_ID
#define HTC_MSG_SETUP_COMPLETE_ID
#define HTC_MSG_SETUP_COMPLETE_EX_ID

#define HTC_MAX_CTRL_MSG_LEN

#define HTC_VERSION_2P0
#define HTC_VERSION_2P1

#define HTC_SERVICE_META_DATA_MAX_LENGTH

#define HTC_CONN_FLGS_THRESH_LVL_QUAT
#define HTC_CONN_FLGS_THRESH_LVL_HALF
#define HTC_CONN_FLGS_THRESH_LVL_THREE_QUAT
#define HTC_CONN_FLGS_REDUCE_CRED_DRIB
#define HTC_CONN_FLGS_THRESH_MASK
/* disable credit flow control on a specific service */
#define HTC_CONN_FLGS_DISABLE_CRED_FLOW_CTRL
#define HTC_CONN_FLGS_SET_RECV_ALLOC_SHIFT
#define HTC_CONN_FLGS_SET_RECV_ALLOC_MASK

/* connect response status codes */
#define HTC_SERVICE_SUCCESS
#define HTC_SERVICE_NOT_FOUND
#define HTC_SERVICE_FAILED

/* no resources (i.e. no more endpoints) */
#define HTC_SERVICE_NO_RESOURCES

/* specific service is not allowing any more endpoints */
#define HTC_SERVICE_NO_MORE_EP

/* report record IDs */
#define HTC_RECORD_NULL
#define HTC_RECORD_CREDITS
#define HTC_RECORD_LOOKAHEAD
#define HTC_RECORD_LOOKAHEAD_BUNDLE

#define HTC_SETUP_COMP_FLG_RX_BNDL_EN
#define HTC_SETUP_COMP_FLG_DISABLE_TX_CREDIT_FLOW

#define MAKE_SERVICE_ID(group, index)

/* NOTE: service ID of 0x0000 is reserved and should never be used */
#define HTC_CTRL_RSVD_SVC
#define WMI_CONTROL_SVC
#define WMI_DATA_BE_SVC
#define WMI_DATA_BK_SVC
#define WMI_DATA_VI_SVC
#define WMI_DATA_VO_SVC
#define WMI_MAX_SERVICES

#define WMM_NUM_AC

/* reserved and used to flush ALL packets */
#define HTC_TX_PACKET_TAG_ALL
#define HTC_SERVICE_TX_PACKET_TAG
#define HTC_TX_PACKET_TAG_USER_DEFINED

/* more packets on this endpoint are being fetched */
#define HTC_RX_FLAGS_INDICATE_MORE_PKTS

/* TODO.. for BMI */
#define ENDPOINT1
/* TODO -remove me, but we have to fix BMI first */
#define HTC_MAILBOX_NUM_MAX

/* enable send bundle padding for this endpoint */
#define HTC_FLGS_TX_BNDL_PAD_EN
#define HTC_EP_ACTIVE

/* HTC operational parameters */
#define HTC_TARGET_RESPONSE_TIMEOUT
#define HTC_TARGET_RESPONSE_POLL_WAIT
#define HTC_TARGET_RESPONSE_POLL_COUNT
#define HTC_TARGET_DEBUG_INTR_MASK
#define HTC_TARGET_CREDIT_INTR_MASK

#define HTC_HOST_MAX_MSG_PER_BUNDLE
#define HTC_MIN_HTC_MSGS_TO_BUNDLE

/* packet flags */

#define HTC_RX_PKT_IGNORE_LOOKAHEAD
#define HTC_RX_PKT_REFRESH_HDR
#define HTC_RX_PKT_PART_OF_BUNDLE
#define HTC_RX_PKT_NO_RECYCLE

#define NUM_CONTROL_BUFFERS
#define NUM_CONTROL_TX_BUFFERS
#define NUM_CONTROL_RX_BUFFERS

#define HTC_RECV_WAIT_BUFFERS
#define HTC_OP_STATE_STOPPING
#define HTC_OP_STATE_SETUP_COMPLETE

/*
 * The frame header length and message formats defined herein were selected
 * to accommodate optimal alignment for target processing. This reduces
 * code size and improves performance. Any changes to the header length may
 * alter the alignment and cause exceptions on the target. When adding to
 * the messagestructures insure that fields are properly aligned.
 */

/* HTC frame header
 *
 * NOTE: do not remove or re-arrange the fields, these are minimally
 * required to take advantage of 4-byte lookaheads in some hardware
 * implementations.
 */
struct htc_frame_hdr {} __packed;

/* HTC ready message */
struct htc_ready_msg {} __packed;

/* extended HTC ready message */
struct htc_ready_ext_msg {} __packed;

/* connect service */
struct htc_conn_service_msg {} __packed;

/* connect response */
struct htc_conn_service_resp {} __packed;

struct htc_setup_comp_msg {} __packed;

/* extended setup completion message */
struct htc_setup_comp_ext_msg {} __packed;

struct htc_record_hdr {} __packed;

struct htc_credit_report {} __packed;

/*
 * NOTE: The lk_ahd array is guarded by a pre_valid
 * and Post Valid guard bytes. The pre_valid bytes must
 * equal the inverse of the post_valid byte.
 */
struct htc_lookahead_report {} __packed;

struct htc_bundle_lkahd_rpt {} __packed;

/* Current service IDs */

enum htc_service_grp_ids {};

/* ------ endpoint IDS ------ */

enum htc_endpoint_id {};

struct htc_tx_packet_info {};

struct htc_rx_packet_info {};

struct htc_target;

/* wrapper around endpoint-specific packets */
struct htc_packet {};

enum htc_send_full_action {};

struct htc_ep_callbacks {};

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

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

/* endpoint distributionstructure */
struct htc_endpoint_credit_dist {};

/*
 * credit distribution code that is passed into the distribution function,
 * there are mandatory and optional codes that must be handled
 */
enum htc_credit_dist_reason {};

struct ath6kl_htc_credit_info {};

/* endpoint statistics */
struct htc_endpoint_stats {};

struct htc_endpoint {};

struct htc_control_buffer {};

struct htc_pipe_txcredit_alloc {};

enum htc_send_queue_result {};

struct ath6kl_htc_ops {};

struct ath6kl_device;

/* our HTC target state */
struct htc_target {};

int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target,
				     u32 msg_look_ahead, int *n_pkts);

static inline void set_htc_pkt_info(struct htc_packet *packet, void *context,
				    u8 *buf, unsigned int len,
				    enum htc_endpoint_id eid, u16 tag)
{}

static inline void htc_rxpkt_reset(struct htc_packet *packet)
{}

static inline void set_htc_rxpkt_info(struct htc_packet *packet, void *context,
				      u8 *buf, unsigned long len,
				      enum htc_endpoint_id eid)
{}

static inline int get_queue_depth(struct list_head *queue)
{}

void ath6kl_htc_pipe_attach(struct ath6kl *ar);
void ath6kl_htc_mbox_attach(struct ath6kl *ar);

#endif