示例#1
0
void
ol_rx_addba_handler(
    ol_txrx_pdev_handle pdev,
    u_int16_t peer_id,
    u_int8_t tid,
    u_int8_t win_sz)
{
    unsigned round_pwr2_win_sz, array_size;
    struct ol_txrx_peer_t *peer;
    struct ol_rx_reorder_t *rx_reorder;

    peer = ol_txrx_peer_find_by_id(pdev, peer_id);
    if (peer == NULL) {
        return;
    }
    rx_reorder = &peer->tids_rx_reorder[tid];

    TXRX_ASSERT2(win_sz <= 64);
    round_pwr2_win_sz = OL_RX_REORDER_ROUND_PWR2(win_sz);
    array_size = round_pwr2_win_sz * sizeof(struct ol_rx_reorder_array_elem_t);
    rx_reorder->array = adf_os_mem_alloc(pdev->osdev, array_size);
    TXRX_ASSERT1(rx_reorder->array);
    adf_os_mem_set(rx_reorder->array, 0x0, array_size);

    rx_reorder->win_sz_mask = round_pwr2_win_sz - 1;
}
示例#2
0
文件: ath_tx99.c 项目: KHATEEBNSIT/AP
int 
tx99_attach(struct ath_softc *sc)
{	
    struct ath_tx99 *tx99 = sc->sc_tx99;
    if (tx99 != NULL) {
		adf_os_print("%s: sc_tx99 was not NULL\n", __FUNCTION__);
		return EINVAL;
	}
    tx99 = adf_os_mem_alloc(NULL, sizeof(struct ath_tx99));
    if (tx99 == NULL) {
		adf_os_print("%s: no memory for tx99 attach\n", __FUNCTION__);
		return ENOMEM;
	}
    adf_os_mem_set(tx99, 0, sizeof(struct ath_tx99));
    sc->sc_tx99 = tx99;
    
    tx99->stop = tx99_stop;
    tx99->start = tx99_start;
    tx99->tx99_state = 0;
    tx99->txpower = 60;
    tx99->txrate = 300000;
    tx99->txfreq = 6;/* ieee channel number */
    tx99->txmode = IEEE80211_MODE_11NG_HT40PLUS;
    tx99->phymode = IEEE80211_MODE_AUTO;
    tx99->chanmask = 1;
    tx99->recv = 0;
    tx99->testmode = TX99_TESTMODE_TX_PN;
    
    return EOK;
}	
示例#3
0
文件: htt.c 项目: KHATEEBNSIT/AP
int
htt_htc_attach(struct htt_pdev_t *pdev)
{
    HTC_SERVICE_CONNECT_REQ connect;
    HTC_SERVICE_CONNECT_RESP response;
    A_STATUS status;

    adf_os_mem_set(&connect, 0, sizeof(connect));
    adf_os_mem_set(&response, 0, sizeof(response));

    connect.pMetaData = NULL;
    connect.MetaDataLength = 0;
    connect.EpCallbacks.pContext = pdev;
    connect.EpCallbacks.EpTxComplete = htt_h2t_send_complete;
    connect.EpCallbacks.EpTxCompleteMultiple = NULL;
    connect.EpCallbacks.EpRecv = htt_t2h_msg_handler;

    /* rx buffers currently are provided by HIF, not by EpRecvRefill */
    connect.EpCallbacks.EpRecvRefill = NULL;
    connect.EpCallbacks.RecvRefillWaterMark = 1; /* N/A, fill is done by HIF */

    connect.EpCallbacks.EpSendFull = htt_h2t_full;
    /*
     * Specify how deep to let a queue get before HTCSendPkt will
     * call the EpSendFull function due to excessive send queue depth.
     */
    connect.MaxSendQueueDepth = HTT_MAX_SEND_QUEUE_DEPTH;

    /* disable flow control for HTT data message service */
    connect.ConnectionFlags |= HTC_CONNECT_FLAGS_DISABLE_CREDIT_FLOW_CTRL;

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

    status = HTCConnectService(pdev->htc_pdev, &connect, &response);

    if (status != A_OK) {
        return 1; /* failure */
    }
    pdev->htc_endpoint = response.Endpoint;

    return 0; /* success */
}
示例#4
0
文件: fwd.c 项目: KHATEEBNSIT/AP
A_STATUS
fwd_device_inserted(HIF_HANDLE hif, adf_os_handle_t os_hdl)
{
    fwd_softc_t    *sc;
    HTC_CALLBACKS   fwd_cb;

    sc = adf_os_mem_alloc(os_hdl, sizeof(fwd_softc_t));
    if (!sc) {
      adf_os_print("FWD: No memory for fwd context\n");
      return -1;
    }

//    adf_os_print("fwd  : ctx allocation done = %p\n",sc);

    adf_os_mem_set(sc, 0, sizeof(fwd_softc_t));

    sc->hif_handle = hif;

    adf_os_timer_init(NULL, &sc->tmr, fwd_timer_expire, sc);
    HIFGetDefaultPipe(hif, &sc->rx_pipe, &sc->tx_pipe);

    sc->image                   = (a_uint8_t *)zcFwImage;
    sc->size                    = zcFwImageSize;
    sc->target_upload_addr      = fw_target_addr;

    fwd_cb.Context              = sc;
    fwd_cb.rxCompletionHandler  = fwd_recv;
    fwd_cb.txCompletionHandler  = fwd_txdone;

    sc->hif_handle              = hif;

adf_os_print("%s, hif: 0x%08x\n", __FUNCTION__, (a_uint32_t)hif);

    HIFPostInit(hif, NULL, &fwd_cb);

adf_os_print("%s, hif: 0x%08x\n", __FUNCTION__, (a_uint32_t)hif);

    hif_boot_start(hif);

    adf_os_print("Downloading\t");

    fwd_start_upload(sc);

    return A_STATUS_OK;
}
struct ath_ratectrl *
ath_rate_attach(struct ath_softc_tgt *sc)
{
	struct atheros_softc *asc;

	asc = adf_os_mem_alloc(sizeof(struct atheros_softc));
	if (asc == NULL)
		return NULL;

	adf_os_mem_set(asc, 0, sizeof(struct atheros_softc));
	asc->arc.arc_space = sizeof(struct atheros_node);

	ar5416AttachRateTables(asc);

	asc->tx_chainmask = 1;
    
	return &asc->arc;
}
示例#6
0
文件: fwd.c 项目: KHATEEBNSIT/AP
hif_status_t
fwd_device_inserted(HIF_HANDLE hif, adf_os_handle_t  os_hdl)
{
    fwd_softc_t    *sc;
    HTC_CALLBACKS   fwd_cb = {0};

    sc = adf_os_mem_alloc(os_hdl ,sizeof(fwd_softc_t));
    if (!sc) {
      adf_os_print("FWD: No memory for fwd context\n");
      return -1;
    }

//    adf_os_print("fwd  : ctx allocation done = %p\n",sc);

    adf_os_mem_set(sc, 0, sizeof(fwd_softc_t));

    sc->hif_handle = hif;

    /*adf_os_timer_init(NULL, &sc->tmr, fwd_timer_expire, sc);*/
    HIFGetDefaultPipe(hif, &sc->rx_pipe, &sc->tx_pipe);

    sc->image                   = (a_uint8_t *)zcFwImage;
    sc->size                    = zcFwImageSize;
    /* #ifdef MDIO_BOOT_LOAD    */
	sc->target_upload_addr      = fw_load_addr;
    /* #else */
    /* sc->target_upload_addr      = fw_target_addr; */
    /* #endif */
    fwd_cb.Context              = sc;
    fwd_cb.rxCompletionHandler  = fwd_recv;
    fwd_cb.txCompletionHandler  = fwd_txdone;

    sc->hif_handle              = hif;

    hif_boot_start(hif);
    
	HIFPostInit(hif, sc, &fwd_cb);

    adf_os_print("Downloading\t");

    fwd_start_upload(sc);

    return HIF_OK;
}
static adf_drv_handle_t
ath_pci_probe(adf_os_resource_t *res,a_int32_t count, adf_os_attach_data_t *data,
	      adf_os_device_t osdev)
{
	struct ath_pci_softc *sc;
	a_uint8_t csz = 32;
	adf_os_pci_dev_id_t *id = (adf_os_pci_dev_id_t *)data;

	adf_os_pci_config_write8(osdev, ATH_PCI_CACHE_LINE_SIZE, csz);
	adf_os_pci_config_write8(osdev, ATH_PCI_LATENCY_TIMER, 0xa8);

	sc = adf_os_mem_alloc(sizeof(struct ath_pci_softc));

	if (sc == NULL) {
		adf_os_print("ath_pci: no memory for device state\n");
		goto bad2;
	}
	adf_os_mem_set(sc, 0, sizeof(struct ath_pci_softc));

	/*
	 * Mark the device as detached to avoid processing
	 * interrupts until setup is complete.
	 */
	sc->aps_sc.sc_invalid = 1;

	adf_os_print("ath_pci_probe %x\n",id->device);

	if (ath_tgt_attach(id->device, res->start, &sc->aps_sc, osdev) != 0)
		goto bad3;

	/* ready to process interrupts */
	sc->aps_sc.sc_invalid = 0;
	adf_os_setup_intr(osdev, ath_intr);
	return (adf_drv_handle_t)sc;
bad3:
bad2:
	return NULL;
}
示例#8
0
文件: htt.c 项目: KHATEEBNSIT/AP
htt_pdev_handle
htt_attach(
    ol_txrx_pdev_handle txrx_pdev,
    ol_pdev_handle ctrl_pdev,
    HTC_HANDLE htc_pdev,
    adf_os_device_t osdev,
    int desc_pool_size)
{
    struct htt_pdev_t *pdev;
    int i;

    pdev = adf_os_mem_alloc(osdev, sizeof(*pdev));

    if (!pdev) {
        goto fail1;
    }

    pdev->osdev = osdev;
    pdev->ctrl_pdev = ctrl_pdev;
    pdev->txrx_pdev = txrx_pdev;
    pdev->htc_pdev = htc_pdev;

    adf_os_mem_set(&pdev->stats, 0, sizeof(pdev->stats));
    pdev->htt_htc_pkt_freelist = NULL;

    /* for efficiency, store a local copy of the is_high_latency flag */
    pdev->cfg.is_high_latency = ol_cfg_is_high_latency(pdev->ctrl_pdev);

    /*
     * Connect to HTC service.
     * This has to be done before calling htt_rx_attach,
     * since htt_rx_attach involves sending a rx ring configure
     * message to the target.
     */
//AR6004 don't need HTT layer.
#ifndef AR6004_HW
    if (htt_htc_attach(pdev)) {
        goto fail2;
    }
#endif
    if (htt_tx_attach(pdev, desc_pool_size)) {
        goto fail2;
    }

    if (htt_rx_attach(pdev)) {
        goto fail3;
    }

    HTT_TX_MUTEX_INIT(&pdev->htt_tx_mutex); 
    HTT_TX_NBUF_QUEUE_MUTEX_INIT(pdev);

    /* pre-allocate some HTC_PACKET objects */
    for (i = 0; i < HTT_HTC_PKT_POOL_INIT_SIZE; i++) {
        struct htt_htc_pkt_union *pkt;
        pkt = adf_os_mem_alloc(pdev->osdev, sizeof(*pkt));
        if (! pkt) {
            break;
        }
        htt_htc_pkt_free(pdev, &pkt->u.pkt);
    }

    if (pdev->cfg.is_high_latency) {
        /*
         * HL - download the whole frame.
         * Specify a download length greater than the max MSDU size,
         * so the downloads will be limited by the actual frame sizes.
         */
        pdev->download_len = 5000;
        if (ol_cfg_tx_free_at_download(pdev->ctrl_pdev)) {
            pdev->tx_send_complete_part2 = ol_tx_download_done_hl_free;
        } else {
            pdev->tx_send_complete_part2 = ol_tx_download_done_hl_retain;
        }

        /*
         * For LL, the FW rx desc directly referenced at its location
         * inside the rx indication message.
         */
/*
 * CHECK THIS LATER: does the HL HTT version of htt_rx_mpdu_desc_list_next
 * (which is not currently implemented) present the adf_nbuf_data(rx_ind_msg)
 * as the abstract rx descriptor?
 * If not, the rx_fw_desc_offset initialization here will have to be
 * adjusted accordingly.
 * NOTE: for HL, because fw rx desc is in ind msg, not in rx desc, so the
 * offset should be negtive value
 */
        pdev->rx_fw_desc_offset =
            HTT_ENDIAN_BYTE_IDX_SWAP(
                    HTT_RX_IND_FW_RX_DESC_BYTE_OFFSET
                    - HTT_RX_IND_HL_BYTES);

        htt_h2t_rx_ring_cfg_msg = htt_h2t_rx_ring_cfg_msg_hl;
    } else {
        /*
         * LL - download just the initial portion of the frame.
         * Download enough to cover the encapsulation headers checked
         * by the target's tx classification descriptor engine.
         */
        /* Get the packet download length */
        pdev->download_len = htt_pkt_dl_len_get(pdev);

        /*
         * Account for the HTT tx descriptor, including the
         * HTC header + alignment padding.
         */
        pdev->download_len += sizeof(struct htt_host_tx_desc_t);

        pdev->tx_send_complete_part2 = ol_tx_download_done_ll;

        /*
         * For LL, the FW rx desc is alongside the HW rx desc fields in
         * the htt_host_rx_desc_base struct/.
         */
        pdev->rx_fw_desc_offset = RX_STD_DESC_FW_MSDU_OFFSET;

        htt_h2t_rx_ring_cfg_msg = htt_h2t_rx_ring_cfg_msg_ll;
    }

    return pdev;

fail3:
    htt_tx_detach(pdev);

fail2:
    adf_os_mem_free(pdev);

fail1:
    return NULL;
}