예제 #1
0
/* registered target arrival callback from the HIF layer */
HTC_HANDLE HTCCreate(void *hHIF, HTC_INIT_INFO *pInfo)
{
    A_STATUS    status = A_OK;
    HTC_TARGET  *target = NULL;
    
    do {
        
        if ((target = (HTC_TARGET *)A_MALLOC(sizeof(HTC_TARGET))) == NULL) {
            AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HTC : Unable to allocate memory\n"));
            status = A_ERROR;
            break;
        }    
        
        A_MEMCPY(&target->HTCInitInfo,pInfo,sizeof(HTC_INIT_INFO));


        adf_os_mem_zero(target, sizeof(HTC_TARGET));

        adf_os_spinlock_init(&target->HTCLock);
        adf_os_spinlock_init(&target->HTCRxLock);
        adf_os_spinlock_init(&target->HTCTxLock);

        /* setup HIF layer callbacks */
        adf_os_mem_zero(&htcCallbacks, sizeof(completion_callbacks_t));
        htcCallbacks.Context = target;
        htcCallbacks.rxCompletionHandler = HTCRxCompletionHandler;
        htcCallbacks.txCompletionHandler = HTCTxCompletionHandler;

        HIFPostInit(hHIF, target, &htcCallbacks);
        
        target->hif_dev = hHIF;

        adf_os_init_mutex(&target->htc_rdy_mutex);
        adf_os_mutex_acquire(&target->htc_rdy_mutex);

        /* Get HIF default pipe for HTC message exchange */
        pEndpoint = &target->EndPoint[ENDPOINT0];
        HIFGetDefaultPipe(hHIF, &pEndpoint->UL_PipeID, &pEndpoint->DL_PipeID);
        adf_os_print("[Default Pipe]UL: %x, DL: %x\n", pEndpoint->UL_PipeID, pEndpoint->DL_PipeID);


        
        /* TODO : other init */
        
    } while (FALSE);


    target->host_handle = htcInfo.pContext;
   /* TODO INTEGRATION supply from host os handle for any os specific calls*/

    target->os_handle = NULL;

    if (A_FAILED(status)) {
        HTCCleanup(target); 
        target = NULL;
    }
    
    return (HTC_HANDLE)target;
}
예제 #2
0
파일: htc_recv.c 프로젝트: KHATEEBNSIT/AP
void HTCRecvInit(HTC_TARGET *target)
{
    /* Initialize CtrlResponseValid to block */
    adf_os_init_mutex(&target->CtrlResponseValid);
    adf_os_mutex_acquire(target->osdev, &target->CtrlResponseValid);
}