/* * Create a memory pool which is DMA capabale */ WDI_Status WDI_DS_MemPoolCreate(WDI_DS_BdMemPoolType *memPool, wpt_uint8 chunkSize, wpt_uint8 numChunks) { wpt_uint8 staLoop; //Allocate all the max size and align them to a double word boundary. The first 8 bytes are control bytes. memPool->numChunks = 0; memPool->chunkSize = chunkSize + 16 - (chunkSize%8); memPool->pVirtBaseAddress = wpalDmaMemoryAllocate((numChunks * memPool->chunkSize), &(memPool->pPhysBaseAddress)); if( memPool->pVirtBaseAddress == 0) return WDI_STATUS_E_FAILURE; memPool->AllocationBitmap = (wpt_uint32*)wpalMemoryAllocate( (numChunks/32 + 1) * sizeof(wpt_uint32)); if( NULL == memPool->AllocationBitmap) return WDI_STATUS_E_FAILURE; wpalMemoryZero(memPool->AllocationBitmap, (numChunks/32+1)*sizeof(wpt_uint32)); //Initialize resource infor per STA for(staLoop = 0; staLoop < WDI_DS_MAX_STA_ID; staLoop++) { memPool->numChunkSTA[staLoop].STAIndex = 0xFF; memPool->numChunkSTA[staLoop].numChunkReservedBySTA = 0; memPool->numChunkSTA[staLoop].validIdx = 0; } return WDI_STATUS_SUCCESS; }
WDI_Status WDI_DS_MemPoolCreate(WDI_DS_BdMemPoolType *memPool, wpt_uint8 chunkSize, wpt_uint8 numChunks) { wpt_uint8 staLoop; memPool->numChunks = 0; memPool->chunkSize = chunkSize + 16 - (chunkSize%8); memPool->pVirtBaseAddress = wpalDmaMemoryAllocate((numChunks * memPool->chunkSize), &(memPool->pPhysBaseAddress)); if( memPool->pVirtBaseAddress == 0) return WDI_STATUS_E_FAILURE; memPool->AllocationBitmap = (wpt_uint32*)wpalMemoryAllocate( (numChunks/32 + 1) * sizeof(wpt_uint32)); if( NULL == memPool->AllocationBitmap) return WDI_STATUS_E_FAILURE; wpalMemoryZero(memPool->AllocationBitmap, (numChunks/32+1)*sizeof(wpt_uint32)); for(staLoop = 0; staLoop < WDI_DS_MAX_STA_ID; staLoop++) { memPool->numChunkSTA[staLoop].STAIndex = 0xFF; memPool->numChunkSTA[staLoop].numChunkReservedBySTA = 0; memPool->numChunkSTA[staLoop].validIdx = 0; } return WDI_STATUS_SUCCESS; }