本文整理汇总了C++中A_MEMZERO函数的典型用法代码示例。如果您正苦于以下问题:C++ A_MEMZERO函数的具体用法?C++ A_MEMZERO怎么用?C++ A_MEMZERO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了A_MEMZERO函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: RecvHCIEvent
static A_STATUS RecvHCIEvent(AR3K_CONFIG_INFO *pConfig,
A_UINT8 *pBuffer,
int *pLength)
{
A_STATUS status = A_OK;
HTC_PACKET *pRecvPacket = NULL;
do {
pRecvPacket = (HTC_PACKET *)A_MALLOC(sizeof(HTC_PACKET));
if (NULL == pRecvPacket) {
status = A_NO_MEMORY;
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to alloc HTC struct \n"));
break;
}
A_MEMZERO(pRecvPacket,sizeof(HTC_PACKET));
SET_HTC_PACKET_INFO_RX_REFILL(pRecvPacket,NULL,pBuffer,*pLength,HCI_EVENT_TYPE);
status = HCI_TransportRecvHCIEventSync(pConfig->pHCIDev,
pRecvPacket,
HCI_EVENT_RESP_TIMEOUTMS);
if (A_FAILED(status)) {
break;
}
*pLength = pRecvPacket->ActualLength;
} while (FALSE);
if (pRecvPacket != NULL) {
A_FREE(pRecvPacket);
}
return status;
}
开发者ID:burstlam,项目名称:AR6kSDK.3.1,代码行数:37,代码来源:ar3kconfig.c
示例2: _HTC_Ready
LOCAL void _HTC_Ready(htc_handle_t htcHandle)
{
adf_nbuf_t pBuffer;
HTC_READY_MSG *pReady;
a_uint8_t *addr;
HTC_CONTEXT *pHTC = (HTC_CONTEXT *)htcHandle;
pBuffer = HTCAllocMsgBuffer(pHTC);
/* an optimization... the header length is chosen to
* be aligned on a 16 bit bounday, the fields in the message are designed to
* be aligned */
addr = adf_nbuf_put_tail(pBuffer, sizeof(HTC_READY_MSG));
pReady = (HTC_READY_MSG *)addr;
A_MEMZERO(pReady,sizeof(HTC_READY_MSG));
pReady->MessageID = adf_os_htons(HTC_MSG_READY_ID);
pReady->CreditSize = adf_os_htons((A_UINT16)pHTC->RecvBufferSize);
pReady->CreditCount = adf_os_htons((A_UINT16)pHTC->TotalCredits);
pReady->MaxEndpoints = ENDPOINT_MAX;
/* send out the message */
HTC_SendMsg(pHTC, ENDPOINT0, pBuffer);
/* now we need to wait for service connection requests */
}
开发者ID:CSRedRat,项目名称:open-ath9k-htc-firmware,代码行数:24,代码来源:htc.c
示例3: htc_start
A_STATUS htc_start(HTC_HANDLE HTCHandle)
{
cdf_nbuf_t netbuf;
A_STATUS status = A_OK;
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
HTC_SETUP_COMPLETE_EX_MSG *pSetupComp;
HTC_PACKET *pSendPacket;
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("htc_start Enter\n"));
do {
htc_config_target_hif_pipe(target);
/* allocate a buffer to send */
pSendPacket = htc_alloc_control_tx_packet(target);
if (NULL == pSendPacket) {
AR_DEBUG_ASSERT(false);
cdf_print("%s: allocControlTxPacket failed\n",
__func__);
status = A_NO_MEMORY;
break;
}
netbuf =
(cdf_nbuf_t) GET_HTC_PACKET_NET_BUF_CONTEXT(pSendPacket);
/* assemble setup complete message */
cdf_nbuf_put_tail(netbuf, sizeof(HTC_SETUP_COMPLETE_EX_MSG));
pSetupComp =
(HTC_SETUP_COMPLETE_EX_MSG *) cdf_nbuf_data(netbuf);
A_MEMZERO(pSetupComp, sizeof(HTC_SETUP_COMPLETE_EX_MSG));
HTC_SET_FIELD(pSetupComp, HTC_SETUP_COMPLETE_EX_MSG,
MESSAGEID, HTC_MSG_SETUP_COMPLETE_EX_ID);
if (!htc_credit_flow) {
AR_DEBUG_PRINTF(ATH_DEBUG_INIT,
("HTC will not use TX credit flow control\n"));
pSetupComp->SetupFlags |=
HTC_SETUP_COMPLETE_FLAGS_DISABLE_TX_CREDIT_FLOW;
} else {
AR_DEBUG_PRINTF(ATH_DEBUG_INIT,
("HTC using TX credit flow control\n"));
}
#ifdef HIF_SDIO
#if ENABLE_BUNDLE_RX
if (HTC_ENABLE_BUNDLE(target))
pSetupComp->SetupFlags |=
HTC_SETUP_COMPLETE_FLAGS_ENABLE_BUNDLE_RECV;
#endif /* ENABLE_BUNDLE_RX */
#endif /* HIF_SDIO */
SET_HTC_PACKET_INFO_TX(pSendPacket,
NULL,
(A_UINT8 *) pSetupComp,
sizeof(HTC_SETUP_COMPLETE_EX_MSG),
ENDPOINT_0, HTC_SERVICE_TX_PACKET_TAG);
status = htc_send_pkt((HTC_HANDLE) target, pSendPacket);
if (A_FAILED(status)) {
break;
}
} while (false);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("htc_start Exit\n"));
return status;
}
开发者ID:S5-APQ8084,项目名称:qcacld-3.0,代码行数:69,代码来源:htc.c
示例4: HTCConnectService
A_STATUS HTCConnectService(HTC_HANDLE HTCHandle,
HTC_SERVICE_CONNECT_REQ *pConnectReq,
HTC_SERVICE_CONNECT_RESP *pConnectResp)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
A_STATUS status = A_OK;
HTC_PACKET *pRecvPacket = NULL;
HTC_PACKET *pSendPacket = NULL;
HTC_CONNECT_SERVICE_RESPONSE_MSG *pResponseMsg;
HTC_CONNECT_SERVICE_MSG *pConnectMsg;
HTC_ENDPOINT_ID assignedEndpoint = ENDPOINT_MAX;
HTC_ENDPOINT *pEndpoint;
unsigned int maxMsgSize = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("+HTCConnectService, target:0x%X SvcID:0x%X \n",
(A_UINT32)target, pConnectReq->ServiceID));
do {
AR_DEBUG_ASSERT(pConnectReq->ServiceID != 0);
if (HTC_CTRL_RSVD_SVC == pConnectReq->ServiceID) {
/* special case for pseudo control service */
assignedEndpoint = ENDPOINT_0;
maxMsgSize = HTC_MAX_CONTROL_MESSAGE_LENGTH;
} else {
/* allocate a packet to send to the target */
pSendPacket = HTC_ALLOC_CONTROL_TX(target);
if (NULL == pSendPacket) {
AR_DEBUG_ASSERT(FALSE);
status = A_NO_MEMORY;
break;
}
/* assemble connect service message */
pConnectMsg = (HTC_CONNECT_SERVICE_MSG *)pSendPacket->pBuffer;
AR_DEBUG_ASSERT(pConnectMsg != NULL);
A_MEMZERO(pConnectMsg,sizeof(HTC_CONNECT_SERVICE_MSG));
pConnectMsg->MessageID = HTC_MSG_CONNECT_SERVICE_ID;
pConnectMsg->ServiceID = pConnectReq->ServiceID;
pConnectMsg->ConnectionFlags = pConnectReq->ConnectionFlags;
/* check caller if it wants to transfer meta data */
if ((pConnectReq->pMetaData != NULL) &&
(pConnectReq->MetaDataLength <= HTC_SERVICE_META_DATA_MAX_LENGTH)) {
/* copy meta data into message buffer (after header ) */
A_MEMCPY((A_UINT8 *)pConnectMsg + sizeof(HTC_CONNECT_SERVICE_MSG),
pConnectReq->pMetaData,
pConnectReq->MetaDataLength);
pConnectMsg->ServiceMetaLength = pConnectReq->MetaDataLength;
}
SET_HTC_PACKET_INFO_TX(pSendPacket,
NULL,
(A_UINT8 *)pConnectMsg,
sizeof(HTC_CONNECT_SERVICE_MSG) + pConnectMsg->ServiceMetaLength,
ENDPOINT_0,
HTC_SERVICE_TX_PACKET_TAG);
/* we want synchronous operation */
pSendPacket->Completion = NULL;
HTC_PREPARE_SEND_PKT(pSendPacket,0,0,0);
status = HTCIssueSend(target,pSendPacket);
if (A_FAILED(status)) {
break;
}
/* wait for response */
status = HTCWaitforControlMessage(target, &pRecvPacket);
if (A_FAILED(status)) {
break;
}
/* we controlled the buffer creation so it has to be properly aligned */
pResponseMsg = (HTC_CONNECT_SERVICE_RESPONSE_MSG *)pRecvPacket->pBuffer;
if ((pResponseMsg->MessageID != HTC_MSG_CONNECT_SERVICE_RESPONSE_ID) ||
(pRecvPacket->ActualLength < sizeof(HTC_CONNECT_SERVICE_RESPONSE_MSG))) {
/* this message is not valid */
AR_DEBUG_ASSERT(FALSE);
status = A_EPROTO;
break;
}
pConnectResp->ConnectRespCode = pResponseMsg->Status;
/* check response status */
if (pResponseMsg->Status != HTC_SERVICE_SUCCESS) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
(" Target failed service 0x%X connect request (status:%d)\n",
pResponseMsg->ServiceID, pResponseMsg->Status));
status = A_EPROTO;
break;
}
assignedEndpoint = (HTC_ENDPOINT_ID) pResponseMsg->EndpointID;
maxMsgSize = pResponseMsg->MaxMsgSize;
if ((pConnectResp->pMetaData != NULL) &&
(pResponseMsg->ServiceMetaLength > 0) &&
(pResponseMsg->ServiceMetaLength <= HTC_SERVICE_META_DATA_MAX_LENGTH)) {
//.........这里部分代码省略.........
开发者ID:32743069,项目名称:amlogic_common_3050,代码行数:101,代码来源:htc_services.c
示例5: hifDeviceInserted
static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id *id)
{
int ret;
HIF_DEVICE * device;
int count;
struct task_struct* startup_task_struct;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("AR6000: hifDeviceInserted, Function: 0x%X, Vendor ID: 0x%X, Device ID: 0x%X, block size: 0x%X/0x%X\n",
func->num, func->vendor, func->device, func->max_blksize, func->cur_blksize));
addHifDevice(func);
device = getHifDevice(func);
spin_lock_init(&device->lock);
spin_lock_init(&device->asynclock);
DL_LIST_INIT(&device->ScatterReqHead);
if (!nohifscattersupport) {
/* try to allow scatter operation on all instances,
* unless globally overridden */
device->scatter_enabled = TRUE;
}
/* enable the SDIO function */
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: claim\n"));
sdio_claim_host(func);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: enable\n"));
if ((id->device & MANUFACTURER_ID_AR6K_BASE_MASK) >= MANUFACTURER_ID_AR6003_BASE) {
/* enable 4-bit ASYNC interrupt on AR6003 or later devices */
ret = Func0_CMD52WriteByte(func->card, CCCR_SDIO_IRQ_MODE_REG, SDIO_IRQ_MODE_ASYNC_4BIT_IRQ);
if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("AR6000: failed to enable 4-bit ASYNC IRQ mode %d \n",ret));
sdio_release_host(func);
return ret;
}
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: 4-bit ASYNC IRQ mode enabled\n"));
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
/* give us some time to enable, in ms */
func->enable_timeout = 100;
#endif
ret = sdio_enable_func(func);
if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("AR6000: %s(), Unable to enable AR6K: 0x%X\n",
__FUNCTION__, ret));
sdio_release_host(func);
return ret;
}
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: set block size 0x%X\n", HIF_MBOX_BLOCK_SIZE));
ret = sdio_set_block_size(func, HIF_MBOX_BLOCK_SIZE);
sdio_release_host(func);
if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("AR6000: %s(), Unable to set block size 0x%x AR6K: 0x%X\n",
__FUNCTION__, HIF_MBOX_BLOCK_SIZE, ret));
return ret;
}
/* Initialize the bus requests to be used later */
A_MEMZERO(device->busRequest, sizeof(device->busRequest));
for (count = 0; count < BUS_REQUEST_MAX_NUM; count ++) {
sema_init(&device->busRequest[count].sem_req, 0);
hifFreeBusRequest(device, &device->busRequest[count]);
}
/* create async I/O thread */
device->async_shutdown = 0;
device->async_task = kthread_create(async_task,
(void *)device,
"AR6K Async");
if (IS_ERR(device->async_task)) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("AR6000: %s(), to create async task\n", __FUNCTION__));
return A_ERROR;
}
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: start async task\n"));
sema_init(&device->sem_async, 0);
wake_up_process(device->async_task );
/* create startup thread */
startup_task_struct = kthread_create(startup_task,
(void *)device,
"AR6K startup");
if (IS_ERR(startup_task_struct)) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("AR6000: %s(), to create startup task\n", __FUNCTION__));
return A_ERROR;
}
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: start startup task\n"));
wake_up_process(startup_task_struct);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: return %d\n", ret));
return ret;
}
开发者ID:AvalueAES,项目名称:rev-sa01,代码行数:96,代码来源:hif.c
示例6: WlanEventThread
/* Internal functions */
static void *
WlanEventThread(void *arg)
{
int left, ret, sd;
struct timeval tv;
socklen_t fromlen;
struct nlmsghdr *h;
fd_set readfds, tempfds;
char buf[WLAN_EVENT_SIZE_MAX];
struct sockaddr_nl from, local;
ABF_WLAN_INFO *pAbfWlanInfo = (ABF_WLAN_INFO *)arg;
ATHBT_FILTER_INFO *pInfo = pAbfWlanInfo->pInfo;
ATH_BT_FILTER_INSTANCE *pInstance = pInfo->pInstance;
A_STATUS status;
A_INFO("Starting the WLAN Event Handler task\n");
A_INFO("Checking WLAN adapter on startup .. \n");
if (!pInstance->pWlanAdapterName) {
Abf_WlanCheckSettings(pAbfWlanInfo->IfName, NULL);
if (pAbfWlanInfo->IfName[0]) {
pAbfWlanInfo->IfIndex = if_nametoindex(pAbfWlanInfo->IfName);
}
}
status = AcquireWlanAdapter(pAbfWlanInfo);
if (A_FAILED(status)) {
A_INFO("No WLAN adapter on startup (OKAY) \n");
}else {
/* Communicate this to the Filter task */
HandleAdapterEvent(pInfo, ATH_ADAPTER_ARRIVED);
A_INFO("WLAN Adapter Added\n");
}
do {
sd = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (sd < 0) {
A_ERR("[%s] socket(PF_NETLINK,SOCK_RAW,NETLINK_ROUTE): %d\n",
__FUNCTION__, sd);
break;
}
A_MEMZERO(&local, sizeof(struct sockaddr_nl));
local.nl_family = AF_NETLINK;
local.nl_groups = RTMGRP_LINK;
if ((ret = bind(sd, (struct sockaddr *) &local, sizeof(local))) < 0) {
A_ERR("[%s] bind(netlink): %d\n", __FUNCTION__, ret);
close(sd);
break;
}
FD_ZERO(&readfds);
FD_SET(sd, &readfds);
while (pAbfWlanInfo->Loop) {
A_MEMCPY(&tempfds, &readfds, sizeof(fd_set));
tv.tv_sec = 1;
tv.tv_usec = 0;
ret = select(sd+1, &tempfds, NULL, NULL, &tv);
if ((ret < 0) && (errno != EINTR)) {
A_ERR("[%s] select failed: %d\n", __FUNCTION__, ret);
break;
} else if ((ret > 0) && (FD_ISSET(sd, &tempfds))) {
fromlen = sizeof(from);
do {
left = recvfrom(sd, buf, sizeof(buf), 0,
(struct sockaddr *) &from, &fromlen);
} while (left == -1 && errno == EINTR);
if (left < 0) {
A_ERR("[%s] recvfrom(netlink)\n", __FUNCTION__);
continue;
// break;
}
h = (struct nlmsghdr *) buf;
while (left >= sizeof(*h)) {
int len, plen;
len = h->nlmsg_len;
plen = len - sizeof(*h);
if (len > left || plen < 0) {
A_ERR("[%s] malformed netlink message\n", __FUNCTION__);
continue;
}
//A_DEBUG("RTM Message Type: %s\n",
// ((h->nlmsg_type == RTM_NEWLINK) ?
// "RTM_NEWLINK" : ((h->nlmsg_type == RTM_DELLINK) ?
// "RTM_DELLINK" : "RTM_OTHER")));
switch (h->nlmsg_type) {
case RTM_NEWLINK:
NewLinkEvent(pInstance, h, plen);
break;
case RTM_DELLINK:
DelLinkEvent(pInstance, h, plen);
break;
default:
//.........这里部分代码省略.........
开发者ID:Ar3kkusu,项目名称:AR6kSDK.3.1,代码行数:101,代码来源:abtfilt_wlan.c
示例7: android_ioctl_siwpriv
//.........这里部分代码省略.........
if (ssid_len>0) {
A_UINT8 idx; /* Clean up the last specific scan items */
for (idx=index; idx<arSta->scanSpecificSsid; ++idx) {
wmi_probedSsid_cmd(arPriv->arWmi, idx, DISABLE_SSID_FLAG, 0, NULL);
}
arSta->scanSpecificSsid = index;
/*
* There is no way to know when we need to send broadcast probe in current Android wpa_supplicant_6
* combo scan implemenation. Always force to sent it here uniti future Android version will set
* the broadcast flags for combo scan.
*/
#if 0
if (broadcastSsid)
#endif
{
/* setup the last index as broadcast SSID for combo scan */
++arSta->scanSpecificSsid;
wmi_probedSsid_cmd(arPriv->arWmi, index, ANY_SSID_FLAG, 0, NULL);
}
}
if (pas_dwell>0) {
/* TODO: Should we change our passive dwell? There may be some impact for bt-coex */
}
if (home_dwell>0) {
/* TODO: Should we adjust home_dwell? How to pass it to wext handler? */
}
if (setScan) {
union iwreq_data miwr;
struct iw_request_info minfo;
struct iw_scan_req scanreq, *pScanReq = NULL;
A_MEMZERO(&minfo, sizeof(minfo));
A_MEMZERO(&miwr, sizeof(miwr));
A_MEMZERO(&scanreq, sizeof(scanreq));
if (ssid_len > 0) {
pScanReq = &scanreq;
memcpy(scanreq.essid, ssid, ssid_len);
scanreq.essid_len = ssid_len;
miwr.data.flags |= IW_SCAN_THIS_ESSID;
}
if (ch > 0) {
pScanReq = &scanreq;
scanreq.num_channels = ch;
memcpy(scanreq.channel_list, chList, ch * sizeof(chList[0]));
miwr.data.flags |= IW_SCAN_THIS_FREQ;
}
if (pScanReq) {
miwr.data.pointer = (__force void __user *)&scanreq;
miwr.data.length = sizeof(scanreq);
}
minfo.cmd = SIOCSIWSCAN;
return setScan(dev, &minfo, &miwr, (char*)pScanReq);
}
return -1;
} else if (strcasecmp(cmd, "MACADDR")==0) {
/* reply comes back in the form "Macaddr = XX:XX:XX:XX:XX:XX" where XX */
A_UCHAR *mac = dev->dev_addr;
len = snprintf(buf, data->length, "Macaddr = %02X:%02X:%02X:%02X:%02X:%02X\n",
mac[0], mac[1], mac[2],
mac[3], mac[4], mac[5]) + 1;
return (copy_to_user(data->pointer, buf, len)==0) ? len : -1;
} else if (strcasecmp(cmd, "SCAN-ACTIVE")==0) {
return 0; /* unsupport function. Suppress the error */
} else if (strcasecmp(cmd, "SCAN-PASSIVE")==0) {
开发者ID:burstlam,项目名称:AR6kSDK.3.1,代码行数:67,代码来源:ar6000_android.c
示例8: DevGMboxSetTargetInterrupt
int DevGMboxSetTargetInterrupt(struct ar6k_device *pDev, int Signal, int AckTimeoutMS)
{
int status = 0;
int i;
u8 buffer[4];
A_MEMZERO(buffer, sizeof(buffer));
do {
if (Signal >= MBOX_SIG_HCI_BRIDGE_MAX) {
status = A_EINVAL;
break;
}
/* set the last buffer to do the actual signal trigger */
buffer[3] = (1 << Signal);
status = HIFReadWrite(pDev->HIFDevice,
INT_WLAN_ADDRESS,
buffer,
sizeof(buffer),
HIF_WR_SYNC_BYTE_FIX, /* hit the register 4 times to align the I/O */
NULL);
if (status) {
break;
}
} while (false);
if (!status) {
/* now read back the register to see if the bit cleared */
while (AckTimeoutMS) {
status = HIFReadWrite(pDev->HIFDevice,
INT_WLAN_ADDRESS,
buffer,
sizeof(buffer),
HIF_RD_SYNC_BYTE_FIX,
NULL);
if (status) {
break;
}
for (i = 0; i < sizeof(buffer); i++) {
if (buffer[i] & (1 << Signal)) {
/* bit is still set */
break;
}
}
if (i >= sizeof(buffer)) {
/* done */
break;
}
AckTimeoutMS--;
A_MDELAY(1);
}
if (0 == AckTimeoutMS) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("DevGMboxSetTargetInterrupt : Ack Timed-out (sig:%d) \n",Signal));
status = A_ERROR;
}
}
return status;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:72,代码来源:ar6k_gmbox.c
示例9: DevGMboxReadCreditCounter
int DevGMboxReadCreditCounter(struct ar6k_device *pDev, bool AsyncMode, int *pCredits)
{
int status = 0;
struct htc_packet *pIOPacket = NULL;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+DevGMboxReadCreditCounter (%s) \n", AsyncMode ? "ASYNC" : "SYNC"));
do {
pIOPacket = AR6KAllocIOPacket(pDev);
if (NULL == pIOPacket) {
status = A_NO_MEMORY;
A_ASSERT(false);
break;
}
A_MEMZERO(pIOPacket->pBuffer,AR6K_REG_IO_BUFFER_SIZE);
if (AsyncMode) {
/* stick in our completion routine when the I/O operation completes */
pIOPacket->Completion = DevGMboxReadCreditsAsyncHandler;
pIOPacket->pContext = pDev;
/* read registers asynchronously */
HIFReadWrite(pDev->HIFDevice,
AR6K_GMBOX_CREDIT_DEC_ADDRESS,
pIOPacket->pBuffer,
AR6K_REG_IO_BUFFER_SIZE, /* hit the register multiple times */
HIF_RD_ASYNC_BYTE_FIX,
pIOPacket);
pIOPacket = NULL;
break;
}
pIOPacket->Completion = NULL;
/* if we get here we are doing it synchronously */
status = HIFReadWrite(pDev->HIFDevice,
AR6K_GMBOX_CREDIT_DEC_ADDRESS,
pIOPacket->pBuffer,
AR6K_REG_IO_BUFFER_SIZE,
HIF_RD_SYNC_BYTE_FIX,
NULL);
} while (false);
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
(" DevGMboxReadCreditCounter failed! status:%d \n", status));
}
if (pIOPacket != NULL) {
if (!status) {
/* sync mode processing */
*pCredits = ProcessCreditCounterReadBuffer(pIOPacket->pBuffer, AR6K_REG_IO_BUFFER_SIZE);
}
AR6KFreeIOPacket(pDev,pIOPacket);
}
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("-DevGMboxReadCreditCounter (%s) (%d) \n",
AsyncMode ? "ASYNC" : "SYNC", status));
return status;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:62,代码来源:ar6k_gmbox.c
示例10: wmi_control_rx
A_STATUS wmi_control_rx(A_UINT8 *pBuffer, int Length)
{
WMI_CMD_HDR *cmd;
A_UINT16 id;
A_UINT8 *datap;
A_UINT32 len;
A_STATUS status = A_OK;
A_CHAR *pWmiDumpStr = "WMI message payload";
if (Length < sizeof(WMI_CMD_HDR)) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("WMI: invalid length: %d \n",Length));
return A_ERROR;
}
cmd = (WMI_CMD_HDR *)pBuffer;
id = cmd->commandId;
datap = pBuffer + sizeof(WMI_CMD_HDR);
len = Length - sizeof(WMI_CMD_HDR);
AR_DEBUG_PRINTF(ATH_DEBUG_WMI, ("---- WMI recv, MsgNo %d, Event ID: 0x%X (%d) ---------------------------\n",
cmdRecvNum, id , id));
cmdRecvNum++;
switch (id) {
case (WMI_READY_EVENTID):
{
WMI_READY_EVENT *ev = (WMI_READY_EVENT *)datap;
AR_DEBUG_PRINTF(ATH_DEBUG_WMI,("WMI_READY_EVENTID\n"));
if (len < sizeof(WMI_READY_EVENT)) {
return A_EINVAL;
}
A_MEMCPY(g_MACAddress, ev->macaddr, ATH_MAC_LEN);
ar6000_ready_event(ev->macaddr, ev->phyCapability);
}
break;
case (WMI_CONNECT_EVENTID):
{
WMI_CONNECT_EVENT *ev;
AR_DEBUG_PRINTF(ATH_DEBUG_WMI,("WMI_CONNECT_EVENTID \n"));
if (len < sizeof(WMI_CONNECT_EVENT)) {
return A_EINVAL;
}
ev = (WMI_CONNECT_EVENT *)datap;
A_MEMCPY(g_bssid, ev->bssid, ATH_MAC_LEN);
ar6000_connect_event(ev->channel, ev->bssid,
ev->listenInterval, ev->beaconInterval,
ev->networkType, ev->beaconIeLen,
ev->assocReqLen, ev->assocRespLen,
ev->assocInfo);
}
break;
case (WMI_DISCONNECT_EVENTID):
{
WMI_DISCONNECT_EVENT *ev;
if (len < sizeof(WMI_DISCONNECT_EVENT)) {
return A_EINVAL;
}
ev = (WMI_DISCONNECT_EVENT *)datap;
A_MEMZERO(g_bssid, ATH_MAC_LEN);
ar6000_disconnect_event(ev->disconnectReason, ev->bssid,
ev->assocRespLen, ev->assocInfo, ev->protocolReasonStatus);
}
break;
case (WMI_REGDOMAIN_EVENTID):
{
WMI_REG_DOMAIN_EVENT *ev;
AR_DEBUG_PRINTF(ATH_DEBUG_WMI, ("WMI_REGDOMAIN_EVENTID\n"));
if (len < sizeof(*ev)) {
return A_EINVAL;
}
ev = (WMI_REG_DOMAIN_EVENT *)datap;
ar6000_regDomain_event(ev->regDomain);
}
break;
case (WMI_EXTENSION_EVENTID):
{
A_UINT16 extId = datap[0] | ((A_UINT16)datap[1]) << 8;
datap += sizeof(WMIX_CMD_HDR);
len -= sizeof(WMIX_CMD_HDR);
//.........这里部分代码省略.........
开发者ID:NemProjects,项目名称:WLAN,代码行数:101,代码来源:u_wmi.c
示例11: ar6000_setup_hci
A_STATUS ar6000_setup_hci(AR_SOFTC_T *ar)
#endif
{
HCI_TRANSPORT_CONFIG_INFO config;
A_STATUS status = A_OK;
int i;
HTC_PACKET *pPacket;
AR6K_HCI_BRIDGE_INFO *pHcidevInfo;
do {
pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)A_MALLOC(sizeof(AR6K_HCI_BRIDGE_INFO));
if (NULL == pHcidevInfo) {
status = A_NO_MEMORY;
break;
}
A_MEMZERO(pHcidevInfo, sizeof(AR6K_HCI_BRIDGE_INFO));
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
g_pHcidevInfo = pHcidevInfo;
pHcidevInfo->HCITransHdl = *(HCI_TRANSPORT_MISC_HANDLES *)ar;
#else
ar->hcidev_info = pHcidevInfo;
pHcidevInfo->ar = ar;
#endif
spin_lock_init(&pHcidevInfo->BridgeLock);
INIT_HTC_PACKET_QUEUE(&pHcidevInfo->HTCPacketStructHead);
ar->exitCallback = AR3KConfigureExit;
status = bt_setup_hci(pHcidevInfo);
if (A_FAILED(status)) {
break;
}
if (pHcidevInfo->HciNormalMode) {
AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE, ("HCI Bridge: running in normal mode... \n"));
} else {
AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE, ("HCI Bridge: running in test mode... \n"));
}
pHcidevInfo->pHTCStructAlloc = (A_UINT8 *)A_MALLOC((sizeof(HTC_PACKET)) * NUM_HTC_PACKET_STRUCTS);
if (NULL == pHcidevInfo->pHTCStructAlloc) {
status = A_NO_MEMORY;
break;
}
pPacket = (HTC_PACKET *)pHcidevInfo->pHTCStructAlloc;
for (i = 0; i < NUM_HTC_PACKET_STRUCTS; i++,pPacket++) {
FreeHTCStruct(pHcidevInfo,pPacket);
}
A_MEMZERO(&config,sizeof(HCI_TRANSPORT_CONFIG_INFO));
config.ACLRecvBufferWaterMark = MAX_ACL_RECV_BUFS / 2;
config.EventRecvBufferWaterMark = MAX_EVT_RECV_BUFS / 2;
config.MaxSendQueueDepth = MAX_HCI_WRITE_QUEUE_DEPTH;
config.pContext = pHcidevInfo;
config.TransportFailure = ar6000_hci_transport_failure;
config.TransportReady = ar6000_hci_transport_ready;
config.TransportRemoved = ar6000_hci_transport_removed;
config.pHCISendComplete = ar6000_hci_send_complete;
config.pHCIPktRecv = ar6000_hci_pkt_recv;
config.pHCIPktRecvRefill = ar6000_hci_pkt_refill;
config.pHCISendFull = ar6000_hci_pkt_send_full;
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
pHcidevInfo->pHCIDev = HCI_TransportAttach(pHcidevInfo->HCITransHdl.htcHandle, &config);
#else
pHcidevInfo->pHCIDev = HCI_TransportAttach(ar->arHtcTarget, &config);
#endif
if (NULL == pHcidevInfo->pHCIDev) {
status = A_ERROR;
}
} while (FALSE);
if (A_FAILED(status)) {
if (pHcidevInfo != NULL) {
if (NULL == pHcidevInfo->pHCIDev) {
/* GMBOX may not be present in older chips */
/* just return success */
status = A_OK;
}
}
ar6000_cleanup_hci(ar);
}
return status;
}
开发者ID:dalingrin,项目名称:android_system_wlan_atheros,代码行数:93,代码来源:hci_bridge.c
示例12: ar6000_hci_transport_ready
static A_STATUS ar6000_hci_transport_ready(HCI_TRANSPORT_HANDLE HCIHandle,
HCI_TRANSPORT_PROPERTIES *pProps,
void *pContext)
{
AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext;
A_STATUS status;
AR_SOFTC_DEV_T *arDev = pHcidevInfo->ar->arDev[0];
pHcidevInfo->pHCIDev = HCIHandle;
A_MEMCPY(&pHcidevInfo->HCIProps,pProps,sizeof(*pProps));
AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE,("HCI ready (hci:0x%lX, headroom:%d, tailroom:%d blockpad:%d) \n",
(unsigned long)HCIHandle,
pHcidevInfo->HCIProps.HeadRoom,
pHcidevInfo->HCIProps.TailRoom,
pHcidevInfo->HCIProps.IOBlockPad));
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
A_ASSERT((pProps->HeadRoom + pProps->TailRoom) <= (struct net_device *)(pHcidevInfo->HCITransHdl.netDevice)->hard_header_len);
#else
A_ASSERT((pProps->HeadRoom + pProps->TailRoom) <= arDev->arNetDev->hard_header_len);
#endif
/* provide buffers */
RefillRecvBuffers(pHcidevInfo, HCI_ACL_TYPE, MAX_ACL_RECV_BUFS);
RefillRecvBuffers(pHcidevInfo, HCI_EVENT_TYPE, MAX_EVT_RECV_BUFS);
do {
/* start transport */
status = HCI_TransportStart(pHcidevInfo->pHCIDev);
if (A_FAILED(status)) {
break;
}
if (!pHcidevInfo->HciNormalMode) {
/* in test mode, no need to go any further */
break;
}
/* The delay is required when AR6K is driving the BT reset line */
/* where time is needed after the BT chip is out of reset (HCI_TransportStart) */
/* and before the first HCI command is issued (AR3KConfigure) */
/* FIXME */
/* The delay should be configurable and be only applied when AR6K driving the BT */
/* reset line. This could be done by some module parameter or based on some HW config */
/* info. For now apply 100ms delay blindly */
A_MDELAY(100);
A_MEMZERO(&ar3kconfig,sizeof(ar3kconfig));
ar3kconfig.pHCIDev = pHcidevInfo->pHCIDev;
ar3kconfig.pHCIProps = &pHcidevInfo->HCIProps;
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
ar3kconfig.pHIFDevice = (HIF_DEVICE *)(pHcidevInfo->HCITransHdl.hifDevice);
#else
ar3kconfig.pHIFDevice = pHcidevInfo->ar->arHifDevice;
#endif
ar3kconfig.pBtStackHCIDev = pHcidevInfo->pBtStackHCIDev;
if (ar3khcibaud != 0) {
/* user wants ar3k baud rate change */
ar3kconfig.Flags |= AR3K_CONFIG_FLAG_SET_AR3K_BAUD;
ar3kconfig.Flags |= AR3K_CONFIG_FLAG_AR3K_BAUD_CHANGE_DELAY;
ar3kconfig.AR3KBaudRate = ar3khcibaud;
}
if ((hciuartscale != 0) || (hciuartstep != 0)) {
/* user wants to tune HCI bridge UART scale/step values */
ar3kconfig.AR6KScale = (A_UINT16)hciuartscale;
ar3kconfig.AR6KStep = (A_UINT16)hciuartstep;
ar3kconfig.Flags |= AR3K_CONFIG_FLAG_SET_AR6K_SCALE_STEP;
}
/* configure the AR3K device */
memcpy(ar3kconfig.bdaddr,arDev->bdaddr,6);
status = AR3KConfigure(&ar3kconfig);
if (A_FAILED(status)) {
extern unsigned int setuphci;
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge: Fail to configure AR3K. No device? Cleanup HCI\n"));
pHcidevInfo->ar->exitCallback = NULL;
ar6000_cleanup_hci(pHcidevInfo->ar);
setuphci = 0;
pHcidevInfo->ar->arBTSharing = 0;
break;
}
/* Make sure both AR6K and AR3K have power management enabled */
if (ar3kconfig.PwrMgmtEnabled) {
A_UINT32 address, hci_uart_pwr_mgmt_params;
/* Fetch the address of the hi_hci_uart_pwr_mgmt_params instance in the host interest area */
address = TARG_VTOP(pHcidevInfo->ar->arTargetType,
HOST_INTEREST_ITEM_ADDRESS(pHcidevInfo->ar->arTargetType, hi_hci_uart_pwr_mgmt_params));
status = ar6000_ReadRegDiag(pHcidevInfo->ar->arHifDevice, &address, &hci_uart_pwr_mgmt_params);
hci_uart_pwr_mgmt_params &= 0xFFFF;
/* wakeup timeout is [31:16] */
hci_uart_pwr_mgmt_params |= (ar3kconfig.WakeupTimeout << 16);
status |= ar6000_WriteRegDiag(pHcidevInfo->ar->arHifDevice, &address, &hci_uart_pwr_mgmt_params);
if (A_OK != status) {
//.........这里部分代码省略.........
开发者ID:dalingrin,项目名称:android_system_wlan_atheros,代码行数:101,代码来源:hci_bridge.c
示例13: busDriverInit
NDIS_STATUS
busDriverInit (NDIS_HANDLE miniportHandle,
NDIS_HANDLE wrapperConfigurationContext,
A_UINT32 sysIntr,
BUS_DRIVER_HANDLE *busDriverHandle)
{
PNDIS_RESOURCE_LIST pNdisResourceList;
PCM_PARTIAL_RESOURCE_DESCRIPTOR pResourceDesc;
NDIS_PHYSICAL_ADDRESS physicalAddress;
A_UINT32 bufferSize;
A_UINT32 dwResourceCount;
NDIS_STATUS status=NDIS_STATUS_FAILURE;
A_UINT32 addressSpace;
*busDriverHandle = NULL;
HIF_DEBUG_PRINTF(ATH_LOG_TRC,
"ar6000CFBusInit: Enter \n");
cfDevice = A_MALLOC(sizeof(CF_DEVICE));
if (cfDevice == NULL) {
HIF_DEBUG_PRINTF(ATH_LOG_ERR,
"ar6000CFBusInit: Allocate Memory for CF_DEVICE failed\n");
return status;
}
A_MEMZERO(cfDevice,sizeof(CF_DEVICE));
cfDevice->miniportHandle = miniportHandle;
cfDevice->wrapperConfigurationContext=wrapperConfigurationContext;
pNdisResourceList = NULL;
bufferSize = 0;
// First call is just to determine buffer size
NdisMQueryAdapterResources(
&status,
wrapperConfigurationContext,
pNdisResourceList,
&bufferSize);
pNdisResourceList = A_MALLOC(bufferSize);
if (pNdisResourceList == NULL) {
HIF_DEBUG_PRINTF(ATH_LOG_ERR,
"ar6000CFBusInit: AllocateMemory for NDIS_RESOURCE_LIST failed\n");
A_FREE(cfDevice);
return NDIS_STATUS_FAILURE;
}
NdisMQueryAdapterResources(
&status,
wrapperConfigurationContext,
pNdisResourceList,
&bufferSize);
if (status != NDIS_STATUS_SUCCESS) {
HIF_DEBUG_PRINTF(ATH_LOG_ERR,
"ar6000CFBusInit: NdisMQueryAdapterResources failed \n");
A_FREE(pNdisResourceList);
A_FREE(cfDevice);
return status;
}
/* Search for I/O address and IRQ in assigned resources. */
dwResourceCount = pNdisResourceList->Count;
pResourceDesc = &(pNdisResourceList->PartialDescriptors[0]);
while (dwResourceCount--) {
switch(pResourceDesc->Type) {
case CmResourceTypeInterrupt:
cfDevice->interruptNumber =
pResourceDesc->u.Interrupt.Vector;
HIF_DEBUG_PRINTF(ATH_LOG_INF,
"ar6000CFBusInit: Interrupt Number = %u\n", cfDevice->interruptNumber);
break;
case CmResourceTypeMemory:
cfDevice->memLen = pResourceDesc->u.Memory.Length;
cfDevice->deviceMemBase = pResourceDesc->u.Memory.Start.LowPart;
HIF_DEBUG_PRINTF(ATH_LOG_INF,
"ar6000CFBusInit: Physical Address = %x Length = %x\n",
cfDevice->deviceMemBase,cfDevice->memLen);
break;
default:
HIF_DEBUG_PRINTF(ATH_LOG_ERR,
"ar6000CFBusInit: Unexpected assigned resource type %u\n",
pResourceDesc->Type);
break;
}
pResourceDesc++;
}
A_FREE(pNdisResourceList);
cfDevice->sysIntr = sysIntr;
HIF_DEBUG_PRINTF(ATH_LOG_INF,
"ar6000CFBusInit: sysIntr = %u\n", cfDevice->sysIntr);
//.........这里部分代码省略.........
开发者ID:NemProjects,项目名称:WLAN,代码行数:101,代码来源:ar6000_cf.c
示例14: ar6000_htc_raw_open
int ar6000_htc_raw_open(AR_SOFTC_T *ar)
{
A_STATUS status;
int streamID, endPt, count2;
raw_htc_buffer *buffer;
HTC_SERVICE_ID servicepriority;
AR_RAW_HTC_T *arRaw = ar->arRawHtc;
if (!arRaw) {
arRaw = ar->arRawHtc = A_MALLOC(sizeof(AR_RAW_HTC_T));
if (arRaw) {
A_MEMZERO(arRaw, sizeof(AR_RAW_HTC_T));
}
}
A_ASSERT(ar->arHtcTarget != NULL);
if (!arRaw) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Faile to allocate memory for HTC RAW interface\n"));
return -ENOMEM;
}
/* wait for target */
status = HTCWaitTarget(ar->arHtcTarget);
if (A_FAILED(status)) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HTCWaitTarget failed (%d)\n", status));
return -ENODEV;
}
for (endPt = 0; endPt < ENDPOINT_MAX; endPt++) {
arRaw->arEp2RawMapping[endPt] = HTC_RAW_STREAM_NOT_MAPPED;
}
for (streamID = HTC_RAW_STREAM_0; streamID < HTC_RAW_STREAM_NUM_MAX; streamID++) {
/* Initialize the data structures */
init_MUTEX(&arRaw->raw_htc_read_sem[streamID]);
init_MUTEX(&arRaw->raw_htc_write_sem[streamID]);
init_waitqueue_head(&arRaw->raw_htc_read_queue[streamID]);
init_waitqueue_head(&arRaw->raw_htc_write_queue[streamID]);
/* try to connect to the raw service */
status = ar6000_connect_raw_service(ar,streamID);
if (A_FAILED(status)) {
break;
}
if (arRawStream2EndpointID(ar,streamID) == 0) {
break;
}
for (count2 = 0; count2 < RAW_HTC_READ_BUFFERS_NUM; count2 ++) {
/* Initialize the receive buffers */
buffer = &arRaw->raw_htc_write_buffer[streamID][count2];
memset(buffer, 0, sizeof(raw_htc_buffer));
buffer = &arRaw->raw_htc_read_buffer[streamID][count2];
memset(buffer, 0, sizeof(raw_htc_buffer));
SET_HTC_PACKET_INFO_RX_REFILL(&buffer->HTCPacket,
buffer,
buffer->data,
HTC_RAW_BUFFER_SIZE,
arRawStream2EndpointID(ar,streamID));
/* Queue buffers to HTC for receive */
if ((status = HTCAddReceivePkt(ar->arHtcTarget, &buffer->HTCPacket)) != A_OK)
{
BMIInit();
return -EIO;
}
}
for (count2 = 0; count2 < RAW_HTC_WRITE_BUFFERS_NUM; count2 ++) {
/* Initialize the receive buffers */
buffer = &arRaw->raw_htc_write_buffer[streamID][count2];
memset(buffer, 0, sizeof(raw_htc_buffer));
}
arRaw->read_buffer_available[streamID] = FALSE;
arRaw->write_buffer_available[streamID] = TRUE;
}
if (A_FAILED(status)) {
return -EIO;
}
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("HTC RAW, number of streams the target supports: %d \n", streamID));
servicepriority = HTC_RAW_STREAMS_SVC; /* only 1 */
/* set callbacks and priority list */
HTCSetCreditDistribution(ar->arHtcTarget,
ar,
NULL, /* use default */
NULL, /* use default */
&servicepriority,
1);
/* Start the HTC component */
if ((status = HTCStart(ar->arHtcTarget)) != A_OK) {
BMIInit();
return -EIO;
}
//.........这里部分代码省略.........
开发者ID:kclin,项目名称:linux-sdk-kernel-source,代码行数:101,代码来源:ar6000_raw_if.c
示例15: ar6000_hci_transport_ready
static int ar6000_hci_transport_ready(HCI_TRANSPORT_HANDLE HCIHandle,
struct hci_transport_properties *pProps,
void *pContext)
{
struct ar6k_hci_bridge_info *pHcidevInfo = (struct ar6k_hci_bridge_info *)pContext;
int status;
u32 address, hci_uart_pwr_mgmt_params;
// struct ar3k_config_info ar3kconfig;
pHcidevInfo->pHCIDev = HCIHandle;
memcpy(&pHcidevInfo->HCIProps,pProps,sizeof(*pProps));
AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE
|
请发表评论