Lines Matching refs:memMap
1573 int dma_init_mem_map(DMA_MemMap_t *memMap)
1575 memset(memMap, 0, sizeof(*memMap));
1577 init_MUTEX(&memMap->lock);
1590 int dma_term_mem_map(DMA_MemMap_t *memMap)
1592 down(&memMap->lock); /* Just being paranoid */
1596 up(&memMap->lock);
1597 memset(memMap, 0, sizeof(*memMap));
1680 int dma_map_start(DMA_MemMap_t *memMap, /* Stores state information about the map */
1685 down(&memMap->lock);
1687 DMA_MAP_PRINT("memMap: %p\n", memMap);
1689 if (memMap->inUse) {
1691 __func__, memMap);
1696 memMap->inUse = 1;
1697 memMap->dir = dir;
1698 memMap->numRegionsUsed = 0;
1706 up(&memMap->lock);
1722 static int dma_map_add_segment(DMA_MemMap_t *memMap, /* Stores state information about the map */
1730 DMA_MAP_PRINT("memMap:%p va:%p pa:0x%x #:%d\n", memMap, virtAddr,
1804 int dma_map_add_region(DMA_MemMap_t *memMap, /* Stores state information about the map */
1814 down(&memMap->lock);
1816 DMA_MAP_PRINT("memMap:%p va:%p #:%d\n", memMap, mem, numBytes);
1818 if (!memMap->inUse) {
1827 if (memMap->numRegionsUsed >= memMap->numRegionsAllocated) {
1830 memMap->numRegionsAllocated * sizeof(*newRegion);
1831 int newAlloc = memMap->numRegionsAllocated + 4;
1839 memcpy(newRegion, memMap->region, oldSize);
1842 kfree(memMap->region);
1844 memMap->numRegionsAllocated = newAlloc;
1845 memMap->region = newRegion;
1848 region = &memMap->region[memMap->numRegionsUsed];
1849 memMap->numRegionsUsed++;
1882 dma_map_single(NULL, mem, numBytes, memMap->dir);
1883 rc = dma_map_add_segment(memMap, region, mem, physAddr,
1900 memMap->dir);
1901 rc = dma_map_add_segment(memMap, region, mem, physAddr,
1918 if (memMap->userTask == NULL) {
1943 userTask = memMap->userTask;
1950 memMap->dir == DMA_FROM_DEVICE, /* write */
1977 dma_map_add_segment(memMap,
2004 dma_map_add_segment(memMap,
2030 memMap->numRegionsUsed--;
2037 up(&memMap->lock);
2052 int dma_map_mem(DMA_MemMap_t *memMap, /* Stores state information about the map */
2059 rc = dma_map_start(memMap, dir);
2061 rc = dma_map_add_region(memMap, mem, numBytes);
2066 dma_unmap(memMap, 0);
2088 DMA_MemMap_t *memMap, /* Memory map that will be used */
2103 down(&memMap->lock);
2108 for (regionIdx = 0; regionIdx < memMap->numRegionsUsed; regionIdx++) {
2109 region = &memMap->region[regionIdx];
2115 if (memMap->dir == DMA_TO_DEVICE) {
2165 for (regionIdx = 0; regionIdx < memMap->numRegionsUsed; regionIdx++) {
2166 region = &memMap->region[regionIdx];
2172 if (memMap->dir == DMA_TO_DEVICE) {
2197 up(&memMap->lock);
2211 int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */
2221 down(&memMap->lock);
2223 for (regionIdx = 0; regionIdx < memMap->numRegionsUsed; regionIdx++) {
2224 region = &memMap->region[regionIdx];
2246 memMap->dir);
2258 memMap->dir);
2294 if (memMap->dir == DMA_FROM_DEVICE) {
2309 memMap->userTask = NULL;
2310 memMap->numRegionsUsed = 0;
2311 memMap->inUse = 0;
2314 up(&memMap->lock);