Example #1
0
static inline int ath9k_htc_connect_svc(struct ath9k_htc_priv *priv,
					u16 service_id,
					void (*tx) (void *,
						    struct sk_buff *,
						    enum htc_endpoint_id,
						    bool txok),
					enum htc_endpoint_id *ep_id)
{
	struct htc_service_connreq req;

	memset(&req, 0, sizeof(struct htc_service_connreq));

	req.service_id = service_id;
	req.ep_callbacks.priv = priv;
	req.ep_callbacks.rx = ath9k_htc_rxep;
	req.ep_callbacks.tx = tx;

	return htc_connect_service(priv->htc, &req, ep_id);
}
Example #2
0
int
wmi_unified_connect_htc_service(struct wmi_unified *wmi_handle,
				void *htc_handle)
{

	int status;
	HTC_SERVICE_CONNECT_RESP response;
	HTC_SERVICE_CONNECT_REQ connect;

	OS_MEMZERO(&connect, sizeof(connect));
	OS_MEMZERO(&response, sizeof(response));

	/* meta data is unused for now */
	connect.pMetaData = NULL;
	connect.MetaDataLength = 0;
	/* these fields are the same for all service endpoints */
	connect.EpCallbacks.pContext = wmi_handle;
	connect.EpCallbacks.EpTxCompleteMultiple =
		NULL /* Control path completion ar6000_tx_complete */;
	connect.EpCallbacks.EpRecv = wmi_control_rx /* Control path rx */;
	connect.EpCallbacks.EpRecvRefill = NULL /* ar6000_rx_refill */;
	connect.EpCallbacks.EpSendFull = NULL /* ar6000_tx_queue_full */;
	connect.EpCallbacks.EpTxComplete =
		wmi_htc_tx_complete /* ar6000_tx_queue_full */;

	/* connect to control service */
	connect.ServiceID = WMI_CONTROL_SVC;

	if ((status =
		     htc_connect_service(htc_handle, &connect, &response)) != EOK) {
		printk
			(" Failed to connect to WMI CONTROL  service status:%d \n",
			status);
		return -1;;
	}
	wmi_handle->wmi_endpoint_id = response.Endpoint;
	wmi_handle->htc_handle = htc_handle;
	wmi_handle->max_msg_len = response.MaxMsgLength;

	return EOK;
}
int ath9k_wmi_connect(struct htc_target *htc, struct wmi *wmi,
		      enum htc_endpoint_id *wmi_ctrl_epid)
{
	struct htc_service_connreq connect;
	int ret;

	wmi->htc = htc;

	memset(&connect, 0, sizeof(connect));

	connect.ep_callbacks.priv = wmi;
	connect.ep_callbacks.tx = ath9k_wmi_ctrl_tx;
	connect.ep_callbacks.rx = ath9k_wmi_ctrl_rx;
	connect.service_id = WMI_CONTROL_SVC;

	ret = htc_connect_service(htc, &connect, &wmi->ctrl_epid);
	if (ret)
		return ret;

	*wmi_ctrl_epid = wmi->ctrl_epid;

	return 0;
}
Example #4
0
A_STATUS htc_wait_target(HTC_HANDLE HTCHandle)
{
	A_STATUS status = A_OK;
	HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
	HTC_READY_EX_MSG *pReadyMsg;
	HTC_SERVICE_CONNECT_REQ connect;
	HTC_SERVICE_CONNECT_RESP resp;
	HTC_READY_MSG *rdy_msg;
	A_UINT16 htc_rdy_msg_id;

	AR_DEBUG_PRINTF(ATH_DEBUG_TRC,
			("htc_wait_target - Enter (target:0x%p) \n", HTCHandle));
	AR_DEBUG_PRINTF(ATH_DEBUG_ANY, ("+HWT\n"));

	do {

		status = hif_start(target->hif_dev);
		if (A_FAILED(status)) {
			AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("hif_start failed\n"));
			break;
		}

		status = htc_wait_recv_ctrl_message(target);

		if (A_FAILED(status)) {
			break;
		}

		if (target->CtrlResponseLength < (sizeof(HTC_READY_EX_MSG))) {
			AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
					("Invalid HTC Ready Msg Len:%d! \n",
					 target->CtrlResponseLength));
			status = A_ECOMM;
			break;
		}

		pReadyMsg = (HTC_READY_EX_MSG *) target->CtrlResponseBuffer;

		rdy_msg = &pReadyMsg->Version2_0_Info;
		htc_rdy_msg_id =
			HTC_GET_FIELD(rdy_msg, HTC_READY_MSG, MESSAGEID);
		if (htc_rdy_msg_id != HTC_MSG_READY_ID) {
			AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
					("Invalid HTC Ready Msg : 0x%X ! \n",
					 htc_rdy_msg_id));
			status = A_ECOMM;
			break;
		}

		target->TotalTransmitCredits =
			HTC_GET_FIELD(rdy_msg, HTC_READY_MSG, CREDITCOUNT);
		target->TargetCreditSize =
			(int)HTC_GET_FIELD(rdy_msg, HTC_READY_MSG, CREDITSIZE);
		target->MaxMsgsPerHTCBundle =
			(A_UINT8) pReadyMsg->MaxMsgsPerHTCBundle;
		/* for old fw this value is set to 0. But the minimum value should be 1,
		 * i.e., no bundling */
		if (target->MaxMsgsPerHTCBundle < 1)
			target->MaxMsgsPerHTCBundle = 1;

		AR_DEBUG_PRINTF(ATH_DEBUG_INIT,
				("Target Ready! : transmit resources : %d size:%d, MaxMsgsPerHTCBundle = %d\n",
				 target->TotalTransmitCredits,
				 target->TargetCreditSize,
				 target->MaxMsgsPerHTCBundle));

		if ((0 == target->TotalTransmitCredits)
		    || (0 == target->TargetCreditSize)) {
			status = A_ECOMM;
			break;
		}
		/* done processing */
		target->CtrlResponseProcessing = false;

		htc_setup_target_buffer_assignments(target);

		/* setup our pseudo HTC control endpoint connection */
		A_MEMZERO(&connect, sizeof(connect));
		A_MEMZERO(&resp, sizeof(resp));
		connect.EpCallbacks.pContext = target;
		connect.EpCallbacks.EpTxComplete = htc_control_tx_complete;
		connect.EpCallbacks.EpRecv = htc_control_rx_complete;
		connect.MaxSendQueueDepth = NUM_CONTROL_TX_BUFFERS;
		connect.ServiceID = HTC_CTRL_RSVD_SVC;

		/* connect fake service */
		status = htc_connect_service((HTC_HANDLE) target,
					     &connect, &resp);

	} while (false);

	AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("htc_wait_target - Exit (%d)\n", status));
	AR_DEBUG_PRINTF(ATH_DEBUG_ANY, ("-HWT\n"));
	return status;
}
Example #5
0
int epping_connect_service(epping_context_t *pEpping_ctx)
{
	int status, i;
	HTC_SERVICE_CONNECT_REQ connect;
	HTC_SERVICE_CONNECT_RESP response;

	cdf_mem_zero(&connect, sizeof(connect));
	cdf_mem_zero(&response, sizeof(response));

	/* these fields are the same for all service endpoints */
	connect.EpCallbacks.pContext = pEpping_ctx;
	connect.EpCallbacks.EpTxCompleteMultiple = epping_tx_complete_multiple;
	connect.EpCallbacks.EpRecv = epping_rx;
	/* epping_tx_complete use Multiple version */
	connect.EpCallbacks.EpTxComplete = NULL;
	connect.MaxSendQueueDepth = 64;

#ifdef HIF_SDIO
	connect.EpCallbacks.EpRecvRefill = epping_refill;
	connect.EpCallbacks.EpSendFull =
		epping_tx_queue_full /* ar6000_tx_queue_full */;
#elif defined(HIF_USB) || defined(HIF_PCI)
	connect.EpCallbacks.EpRecvRefill = NULL /* provided by HIF */;
	connect.EpCallbacks.EpSendFull = NULL /* provided by HIF */;
	/* disable flow control for hw flow control */
	connect.ConnectionFlags |= HTC_CONNECT_FLAGS_DISABLE_CREDIT_FLOW_CTRL;
#endif

	/* connect to service */
	connect.ServiceID = WMI_DATA_BE_SVC;
	status = htc_connect_service(pEpping_ctx->HTCHandle, &connect, &response);
	if (status != EOK) {
		EPPING_LOG(CDF_TRACE_LEVEL_FATAL,
			   "Failed to connect to Endpoint Ping BE service status:%d \n",
			   status);
		return -1;;
	} else {
		EPPING_LOG(CDF_TRACE_LEVEL_FATAL,
			   "eppingtest BE endpoint:%d\n", response.Endpoint);
	}
	pEpping_ctx->EppingEndpoint[0] = response.Endpoint;

#if defined(HIF_PCI) || defined(HIF_USB)
	connect.ServiceID = WMI_DATA_BK_SVC;
	status = htc_connect_service(pEpping_ctx->HTCHandle, &connect, &response);
	if (status != EOK) {
		EPPING_LOG(CDF_TRACE_LEVEL_FATAL,
			   "Failed to connect to Endpoint Ping BK service status:%d \n",
			   status);
		return -1;;
	} else {
		EPPING_LOG(CDF_TRACE_LEVEL_FATAL,
			   "eppingtest BK endpoint:%d\n", response.Endpoint);
	}
	pEpping_ctx->EppingEndpoint[1] = response.Endpoint;
	/* Since we do not create other two SVC use BK endpoint
	 * for rest ACs (2, 3) */
	for (i = 2; i < EPPING_MAX_NUM_EPIDS; i++) {
		pEpping_ctx->EppingEndpoint[i] = response.Endpoint;
	}
#else
	/* we only use one endpoint for high latenance bus.
	 * Map all AC's EPIDs to the same endpoint ID returned by HTC */
	for (i = 0; i < EPPING_MAX_NUM_EPIDS; i++) {
		pEpping_ctx->EppingEndpoint[i] = response.Endpoint;
	}
#endif
	return 0;
}