1 /* 2 * Copyright (c) 2006-2024 RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2024-08-16 zhujiale first version 9 */ 10 #ifndef __SDHCI_DMA_H__ 11 #define __SDHCI_DMA_H__ 12 13 #include "ioremap.h" 14 #include <mm_aspace.h> 15 enum dma_data_direction 16 { 17 DMA_BIDIRECTIONAL = 0, 18 DMA_TO_DEVICE = 1, 19 DMA_FROM_DEVICE = 2, 20 DMA_NONE = 3, 21 }; 22 #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL << (n)) - 1)) 23 24 int dma_set_mask_and_coherent(struct rt_device *dev, rt_uint64_t mask); 25 unsigned long virt_to_phys(volatile void *address); 26 void *dma_alloc_coherent(struct rt_device *dev, size_t size, 27 rt_uint64_t *dma_handle); 28 void dma_free_coherent(struct rt_device *dev, size_t size, 29 void *cpu_addr, unsigned long dma_handle); 30 31 #endif 32