コード例 #1
0
ファイル: hif_scatter.c プロジェクト: ShawnOfMisfit/ambarella
static void FreeScatterReq(HIF_DEVICE *device, HIF_SCATTER_REQ *pReq)
{
    CriticalSectionAcquire(&lock);
    
    DL_ListInsertTail(&device->ScatterReqHead, &pReq->ListLink);
    
    CriticalSectionRelease(&lock);
    
}
コード例 #2
0
ファイル: hif.c プロジェクト: EddyKuo/linux-sdk-kernel-source
void
hifFreeBusRequest(HIF_DEVICE *device, BUS_REQUEST *request)
{
    AR_DEBUG_ASSERT(request != NULL);

    /* Acquire lock */
    CriticalSectionAcquire(&device->lock);
        /* get the head and chain it */
    request->next = device->busrequestfreelist;
        /* set new head */
    device->busrequestfreelist = request;
    
    /* Release lock */
    CriticalSectionRelease(&device->lock);
}
コード例 #3
0
ファイル: hif_scatter.c プロジェクト: ShawnOfMisfit/ambarella
static HIF_SCATTER_REQ *AllocScatterReq(HIF_DEVICE *device) 
{
    DL_LIST *pItem; 
    
    CriticalSectionAcquire(&lock);
    
    pItem = DL_ListRemoveItemFromHead(&device->ScatterReqHead);
    
    CriticalSectionRelease(&lock);
    
    if (pItem != NULL) {
        return A_CONTAINING_STRUCT(pItem, HIF_SCATTER_REQ, ListLink);
    }
    
    return NULL;   
}
コード例 #4
0
ファイル: hif.c プロジェクト: EddyKuo/linux-sdk-kernel-source
BUS_REQUEST *
hifAllocateBusRequest(HIF_DEVICE *device) 
{
    BUS_REQUEST *request = NULL;

    /* Acquire Lock */
    CriticalSectionAcquire(&device->lock);

    if (device->busrequestfreelist != NULL) {
            /* remove from head */
        request = device->busrequestfreelist;
        device->busrequestfreelist = request->next;
        request->next = NULL; 
    }
    
    /* Release lock */
    CriticalSectionRelease(&device->lock);

    return request;
}
コード例 #5
0
ファイル: hif.c プロジェクト: EddyKuo/linux-sdk-kernel-source
static A_STATUS hifMaskUnmaskRecvMsg(HIF_DEVICE              *device,
                                     A_BOOL                  Mask,
                                     void                    *AsyncContext)
{
    A_BOOL receiverReEnabled = FALSE;
    
    CriticalSectionAcquire(&device->lock);
    
    if (Mask) {
        device->enabledSpiInts &= ~ATH_SPI_INTR_PKT_AVAIL;      
    } else {
            /* unmasking */
        if (!(device->enabledSpiInts & ATH_SPI_INTR_PKT_AVAIL)) {
                /* the receiver was previously disabled and then re-enabled
                 * again, we use this to trigger to re-check for interrupts again */
            receiverReEnabled = TRUE;    
        }
        device->enabledSpiInts |= ATH_SPI_INTR_PKT_AVAIL;          
    }
      
        /* Release lock */
    CriticalSectionRelease(&device->lock);  
    
    if (AsyncContext != NULL) {
            /* just callback to emulate async behavior */
        device->htcCallbacks.rwCompletionHandler(AsyncContext, A_OK);        
    }
    
    if (receiverReEnabled && (AsyncContext == NULL)) {
            /* recheck pending interrupts, this is to catch messages that may have
             * queued into the SPI buffer, but the host did not have any resources
             * to fetch them till now */
        device->htcCallbacks.dsrHandler(device->htcCallbacks.context);        
    }
    
    return A_OK;
}