亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? htc_send.c

?? WLAN在AR6000程序中的驅動代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
//------------------------------------------------------------------------------
// <copyright file="htc_send.c" company="Atheros">
//    Copyright (c) 2006 Microsoft Corporation.  All rights reserved.
//    Copyright (c) 2006 Atheros Corporation.  All rights reserved.
//
//    The use and distribution terms for this software are covered by the
//    Microsoft Limited Permissive License (Ms-LPL) 
//    http://www.microsoft.com/resources/sharedsource/licensingbasics/limitedpermissivelicense.mspx 
//    which can be found in the file MS-LPL.txt at the root of this distribution.
//    By using this software in any fashion, you are agreeing to be bound by
//    the terms of this license.
//
//    You must not remove this notice, or any other, from this software.
// </copyright>
// 
// <summary>
//    Windows CE Wifi Driver for AR-6000
// </summary>
//------------------------------------------------------------------------------
//==============================================================================
// This file contains the routines handling the transmit path.
//
// Author(s): ="Atheros"
//==============================================================================


#include "htc_internal.h"

/* ------ Global Variable Declarations ------- */
extern A_MUTEX_T creditCS,txCS;

#ifdef DEBUG
extern A_UINT32 debughtc;
extern A_UINT32 txcreditsavailable[HTC_MAILBOX_NUM_MAX];
extern A_UINT32 txcreditsconsumed[HTC_MAILBOX_NUM_MAX];
#ifdef HTC_SYNC
extern A_UINT32 txcreditintrenable[HTC_MAILBOX_NUM_MAX];
extern A_UINT32 txcreditintrenableaggregate[HTC_MAILBOX_NUM_MAX];
#endif
#endif

extern A_UINT32 tx_attempt[HTC_MAILBOX_NUM_MAX];  /* Num of attempts to add */
extern A_UINT32 tx_post[HTC_MAILBOX_NUM_MAX];     /* Num of attemps succeded */
extern A_UINT32 tx_complete[HTC_MAILBOX_NUM_MAX]; /* Num of tx complete */

void htcSendFrameLocked(HTC_ENDPOINT *endPoint);

/* ------ Functions ------ */
A_STATUS 
HTCBufferSend(HTC_TARGET *target, 
              HTC_ENDPOINT_ID endPointId,
              A_UCHAR *buffer, 
              A_UINT32 length,
              void *cookie)
{
    A_STATUS status;
    HTC_ENDPOINT *endPoint;
    HTC_DATA_REQUEST_QUEUE *sendQueue;

    HTC_DEBUG_PRINTF(ATH_LOG_TRC | ATH_LOG_SEND, 
                    "HTCBufferSend: Enter (endPointId: %d, buffer: 0x%p, length: %d, cookie: 0x%p)\n", endPointId, buffer, length, cookie);

    AR_DEBUG_ASSERT((endPointId >= ENDPOINT1) && (endPointId <= ENDPOINT4));
    AR_DEBUG_ASSERT(length);

    /* Extract the end point instance */
    endPoint = &target->endPoint[endPointId];
    AR_DEBUG_ASSERT(endPoint != NULL);
    sendQueue = &endPoint->sendQueue;
    AR_DEBUG_ASSERT(sendQueue != NULL);
    HTC_DEBUG_PRINTF(ATH_LOG_INF | ATH_LOG_SEND, 
                    "mboxQueue: %p\n", sendQueue);

    /* 
     * Add this posted buffer to the pending send queue. We need to allocate 
     * a bufferElement to store the packet information and we borrow that 
     * buffer from the pending send queue. If circumstances allow us to 
     * transmit it right away then we dequeue it otherwise we let it remain 
     * to be picked in the interrupt handler context.
     */
    tx_attempt[endPointId] += 1;

    if (!endPoint->enabled) {
        HTC_DEBUG_PRINTF(ATH_LOG_ERR | ATH_LOG_SEND, "Endpoint not enabled: %d\n", 
                                        GET_ENDPOINT_ID(endPoint));
        HTC_DEBUG_PRINTF(ATH_LOG_ERR | ATH_LOG_SEND, 
                        "tx_attempt[%d] = %d, tx_post[%d] = %d, tx_complete[%d] = %d\n", endPointId, tx_attempt[endPointId], endPointId, tx_post[endPointId], endPointId, tx_complete[endPointId]);
        return A_ERROR;
    }

    status = addToMboxQueue(sendQueue, buffer, length, 0, cookie);
    if (status != A_OK) {
        HTC_DEBUG_PRINTF(ATH_LOG_ERR | ATH_LOG_SEND,
                        "Mailbox (%d) PSQ full. Unable to add buffer\n", 
                         endPointId);
        HTC_DEBUG_PRINTF(ATH_LOG_ERR | ATH_LOG_SEND, 
                        "tx_attempt[%d] = %d, tx_post[%d] = %d, tx_complete[%d] = %d\n", endPointId, tx_attempt[endPointId], endPointId, tx_post[endPointId], endPointId, tx_complete[endPointId]);
        return A_ERROR;
    }

    tx_post[endPointId] += 1;

    /* 
     * The frame shall be dequeued and sent if there are any credits 
     * available. 
     */
    htcSendFrame(endPoint);

    HTC_DEBUG_PRINTF(ATH_LOG_TRC | ATH_LOG_SEND, "HTCBufferSend: Exit\n");
    return A_OK;
}

void
htcSendFrame(HTC_ENDPOINT *endPoint) 
{
	A_MUTEX_LOCK(&txCS);	
	htcSendFrameLocked(endPoint);
	A_MUTEX_UNLOCK(&txCS);
}

void 
htcSendFrameLocked(HTC_ENDPOINT *endPoint) 
{
    A_STATUS status;
    A_UINT32 address;
    HIF_DATAMODE dmode;
    HTC_TARGET *target;
    HIF_REQUEST request;
    A_UINT32 frameLength;
    A_UINT32 paddedLength;
    HTC_EVENT_INFO eventInfo;
#ifdef ONLY_16BIT
    A_UINT16 txCreditsConsumed;
    A_UINT16 txCreditsAvailable;
#else
    A_UINT8 txCreditsConsumed;
    A_UINT8 txCreditsAvailable;
#endif
    HTC_ENDPOINT_ID endPointId;
    HTC_QUEUE_ELEMENT *element;
    HTC_MBOX_BUFFER *mboxBuffer;
    HTC_REG_REQUEST_LIST *regList;
    HTC_DATA_REQUEST_QUEUE *sendQueue;
#ifdef HTC_SYNC
    HTC_REG_BUFFER *regBuffer;
#endif

    HTC_DEBUG_PRINTF(ATH_LOG_TRC | ATH_LOG_SEND, "htcSendFrame - Enter\n");

    /* Get the context */
    AR_DEBUG_ASSERT(endPoint != NULL);
    endPointId = GET_ENDPOINT_ID(endPoint);
    target = endPoint->target;
    AR_DEBUG_ASSERT(target != NULL);
    sendQueue = &endPoint->sendQueue;
    AR_DEBUG_ASSERT(sendQueue != NULL);
    regList = &target->regList;
    AR_DEBUG_ASSERT(regList != NULL);

    /* 
     * Transmit the frames as long as we have the credits available and
     * the queue is not out of them 
     */
    HTC_DEBUG_PRINTF(ATH_LOG_SYNC,
                    "Critical Section (credit): LOCK at line %d in file %s\n", __LINE__, __FILE__);
    A_MUTEX_LOCK(&creditCS);
    txCreditsAvailable = GET_TX_CREDITS_AVAILABLE(endPoint);
    txCreditsConsumed = GET_TX_CREDITS_CONSUMED(endPoint);
    SET_TX_CREDITS_AVAILABLE(endPoint, 0);
    SET_TX_CREDITS_CONSUMED(endPoint, txCreditsConsumed + txCreditsAvailable);
    HTC_DEBUG_PRINTF(ATH_LOG_SYNC,
                    "Critical Section (credit): UNLOCK at line %d in file %s\n", __LINE__, __FILE__);
    A_MUTEX_UNLOCK(&creditCS);

    if (!txCreditsAvailable) {
        return;
    }

    /* 
     * Send the packet only when there are packets to be sent and there
     * are positive number of credits available.
     */
    while((!IS_DATA_QUEUE_EMPTY(sendQueue)) && txCreditsAvailable)
    {
        /* Get the request buffer from the Pending Send Queue */
        element = removeFromMboxQueue(sendQueue);
        mboxBuffer = GET_MBOX_BUFFER(element);

        /* 
         * Prepend the actual length in the first 2 bytes of the outgoing 
         * packet.
         */
        mboxBuffer->buffer -= HTC_HEADER_LEN;
        A_MEMCPY(mboxBuffer->buffer, &mboxBuffer->bufferLength, HTC_HEADER_LEN);

        /* 
         * Adjust the length in the block mode only when its not an integral 
         * multiple of the block size. Assumption is that the block size is
         * a power of 2.
         */
        frameLength = mboxBuffer->bufferLength + HTC_HEADER_LEN;
        paddedLength = (frameLength + (endPoint->blockSize - 1)) & 
                       (~(endPoint->blockSize - 1));
        mboxBuffer->actualLength = paddedLength;
        HTC_DEBUG_PRINTF(ATH_LOG_INF | ATH_LOG_SEND,  
                        "Original frame length: %d, Padded frame length: %d\n", frameLength, paddedLength);

        HTC_DEBUG_PRINTBUF(mboxBuffer->buffer, (A_UINT16)mboxBuffer->actualLength);
        HTC_DEBUG_PRINTF(ATH_LOG_INF | ATH_LOG_SEND,  
                        "Available Tx credits: %d\n", txCreditsAvailable);

        /* Frame the interface request */
        dmode = (endPoint->blockSize > 1) ? HIF_BLOCK_BASIS : HIF_BYTE_BASIS;
        HIF_FRAME_REQUEST(&request, HIF_WRITE, HIF_EXTENDED_IO, 
                          HIF_ASYNCHRONOUS, dmode, HIF_INCREMENTAL_ADDRESS);
        address = HIF_MBOX_START_ADDR(endPointId);

        /* Send the data to the bus driver */
        status = HIFReadWrite(target->device, address, mboxBuffer->buffer, 
                              mboxBuffer->actualLength, &request, element);
#ifndef HTC_SYNC
        if (status != A_OK) {
#else
		if (status != A_OK && status != A_PENDING) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
粉嫩一区二区三区在线看| 午夜精品爽啪视频| 欧美va天堂va视频va在线| 欧美剧情电影在线观看完整版免费励志电影| 国产一区二三区| 青青草国产精品亚洲专区无| 三级一区在线视频先锋| 夜色激情一区二区| 亚洲综合一二三区| 一区二区三区国产精华| 亚洲一级在线观看| 日韩高清不卡一区二区三区| 日本色综合中文字幕| 久久精品国产在热久久| 色综合咪咪久久| 99精品视频一区| 一本大道久久精品懂色aⅴ| 色婷婷av久久久久久久| 欧美性欧美巨大黑白大战| 欧美日韩国产在线观看| 日韩一区二区精品| www精品美女久久久tv| 国产喂奶挤奶一区二区三区| 国产精品免费视频网站| 中文字幕一区二区三区色视频| 亚洲欧美日韩中文播放| 一区二区三区久久久| 蜜桃视频免费观看一区| 国产成人精品免费在线| 欧美中文字幕一区二区三区亚洲| 欧美理论片在线| 2020国产精品| 亚洲天堂av一区| 亚洲成人你懂的| 国产乱国产乱300精品| 91农村精品一区二区在线| 91精品国产综合久久婷婷香蕉| 日韩午夜在线播放| 国产精品天天看| 亚洲国产乱码最新视频| 国产一区二区三区在线观看精品 | 成人高清av在线| 欧美日韩一级二级| 亚洲国产高清aⅴ视频| 婷婷丁香久久五月婷婷| 成人国产精品免费观看视频| 69p69国产精品| 国产精品国产馆在线真实露脸| 午夜国产精品影院在线观看| 高清国产一区二区| 日韩欧美黄色影院| 亚洲一二三区视频在线观看| 国产91色综合久久免费分享| 欧美日本一区二区三区四区| 国产精品女人毛片| 美女网站一区二区| 欧美日韩国产综合一区二区三区| 久久久精品影视| 蜜桃视频在线观看一区| 欧美视频在线播放| 欧美国产丝袜视频| 开心九九激情九九欧美日韩精美视频电影| 日本道精品一区二区三区| 国产日韩av一区| 国内不卡的二区三区中文字幕| 91.com在线观看| 亚洲第一电影网| 在线观看日韩电影| 一区二区三区小说| 91丨九色丨蝌蚪富婆spa| 国产精品嫩草99a| 国产一区二区中文字幕| 久久噜噜亚洲综合| 精品一区二区免费| 亚洲女与黑人做爰| 国产suv精品一区二区883| 日韩你懂的在线播放| 精品在线一区二区| 久久―日本道色综合久久| 久久国产精品一区二区| 欧美va亚洲va香蕉在线| 精品一二三四区| 久久综合九色欧美综合狠狠| 久久电影网电视剧免费观看| 日韩精品一区二区三区视频在线观看 | 奇米四色…亚洲| 欧美mv日韩mv| 国产一区二区看久久| 久久青草国产手机看片福利盒子| 韩国三级中文字幕hd久久精品| 欧美mv日韩mv亚洲| 国产成人精品三级| 依依成人精品视频| 欧美日韩精品一区二区三区 | 91麻豆精品国产自产在线观看一区 | 欧美熟乱第一页| 午夜av区久久| 精品国产一区二区三区久久久蜜月| 久久99久久久欧美国产| 国产亚洲精品aa| 色综合色综合色综合| 午夜电影一区二区| 欧美精品一区二区三区蜜臀 | 夜夜精品浪潮av一区二区三区| 在线中文字幕不卡| 日本女优在线视频一区二区| 国产欧美久久久精品影院| 91丨九色丨蝌蚪丨老版| 美女看a上一区| 中日韩av电影| 91精品国产综合久久久久久久久久| 国内精品免费**视频| 亚洲久本草在线中文字幕| 欧美肥大bbwbbw高潮| 国产91精品在线观看| 亚洲6080在线| 国产精品网站一区| 91精品国产综合久久福利 | 最新日韩av在线| 欧美精品 日韩| 粉嫩绯色av一区二区在线观看| 亚洲图片欧美视频| 国产日韩欧美一区二区三区综合| 欧美日韩一区二区欧美激情| 国产成人精品网址| 老司机精品视频线观看86| 亚洲人一二三区| wwww国产精品欧美| 日韩一区二区三区四区 | 亚洲国产综合人成综合网站| 久久久久久综合| 欧美日韩不卡一区二区| 成人免费高清视频在线观看| 免费在线观看日韩欧美| 亚洲国产精品自拍| 亚洲天堂精品视频| 国产精品美女久久久久久久久久久 | 亚洲日本中文字幕区| 国产亚洲精品中文字幕| 日韩欧美一区在线| 欧美男生操女生| 欧美日韩综合不卡| 日本高清不卡在线观看| eeuss鲁片一区二区三区在线看| 精品午夜一区二区三区在线观看| 午夜精品视频在线观看| 亚洲午夜电影在线观看| 一区二区三区日韩欧美| 亚洲欧美一区二区三区国产精品 | 欧美手机在线视频| 91麻豆国产精品久久| 成人黄色av电影| 成人精品电影在线观看| 国产凹凸在线观看一区二区| 国产.欧美.日韩| 国产综合成人久久大片91| 国产一区二区三区最好精华液| 黄网站免费久久| 国产一区二区中文字幕| 国产成人在线看| 丁香婷婷综合五月| 99视频精品在线| 9人人澡人人爽人人精品| gogogo免费视频观看亚洲一| 一本久久a久久精品亚洲| 欧美性生活大片视频| 7777精品伊人久久久大香线蕉超级流畅 | 91国偷自产一区二区使用方法| 99精品在线免费| 欧美亚男人的天堂| 欧美一区二区三区公司| www成人在线观看| 国产精品麻豆久久久| 一区二区激情小说| 日韩不卡手机在线v区| 紧缚奴在线一区二区三区| 国产精品一区免费视频| 成人av网在线| 欧美性猛交xxxxxxxx| 日韩欧美精品在线| 国产精品成人免费在线| 亚洲一二三四区| 韩国av一区二区三区四区| 99久久国产综合色|国产精品| 在线亚洲免费视频| 26uuu亚洲综合色| 亚洲素人一区二区| 日韩**一区毛片| 成人av资源在线观看| 欧美日韩的一区二区| 国产欧美一区二区三区在线看蜜臀| 一区二区三区四区国产精品| 美女久久久精品| 色综合一区二区| xnxx国产精品| 亚洲国产一区二区在线播放| 国产一二精品视频| 精品污污网站免费看| 欧美激情资源网| 美国十次综合导航|