lipengfei28 commented on code in PR #16767: URL: https://github.com/apache/nuttx/pull/16767#discussion_r2245276290
########## drivers/pci/pci_epc.c: ########## @@ -1036,3 +1053,92 @@ void pci_epc_destroy(FAR struct pci_epc_ctrl_s *epc) nxmutex_destroy(&epc->lock); kmm_free(epc); } + +/**************************************************************************** + * Name: pci_epc_dma_alloc + * + * Description: + * This function is used to create a new endpoint controller (EPC) device. + * + * Invoke to destroy the PCI EPC device. + * + * Input Parameters: + * epc - The EPC device that has to be destroyed + * size - The dma memory size + * + * Returned Value: + * The point of dma memory if success, NULL if failed + * + ****************************************************************************/ + +FAR void *pci_epc_dma_alloc(FAR struct pci_epc_ctrl_s *epc, size_t size) +{ + if (epc->dmaheap) Review Comment: done ########## drivers/pci/pci_epc.c: ########## @@ -1036,3 +1053,92 @@ void pci_epc_destroy(FAR struct pci_epc_ctrl_s *epc) nxmutex_destroy(&epc->lock); kmm_free(epc); } + +/**************************************************************************** + * Name: pci_epc_dma_alloc + * + * Description: + * This function is used to create a new endpoint controller (EPC) device. + * + * Invoke to destroy the PCI EPC device. + * + * Input Parameters: + * epc - The EPC device that has to be destroyed + * size - The dma memory size + * + * Returned Value: + * The point of dma memory if success, NULL if failed + * + ****************************************************************************/ + +FAR void *pci_epc_dma_alloc(FAR struct pci_epc_ctrl_s *epc, size_t size) +{ + if (epc->dmaheap) + { + return mm_malloc(epc->dmaheap, size); + } + else + { + return kmm_malloc(size); + } +} + +/**************************************************************************** + * Name: pci_epc_dma_memalign + * + * Description: + * This function is used to create a new endpoint controller (EPC) device. + * + * Invoke to destroy the PCI EPC device. + * + * Input Parameters: + * epc - The EPC device that has to be destroyed + * alignment - Alignment size + * size - The dma memory size + * + * Returned Value: + * The point of dma memory if success, NULL if failed + * + ****************************************************************************/ + +FAR void *pci_epc_dma_memalign(FAR struct pci_epc_ctrl_s *epc, + size_t alignment, size_t size) +{ + if (epc->dmaheap) + { + return mm_memalign(epc->dmaheap, alignment, size); + } + else + { + return kmm_memalign(alignment, size); + } +} + +/**************************************************************************** + * Name: pci_epc_dma_free + * + * Description: + * This function is used to create a new endpoint controller (EPC) device. + * + * Invoke to destroy the PCI EPC device. + * + * Input Parameters: + * epc - The EPC device that has to be destroyed + * mem - The dma memory need ed to be free + * + * Returned Value: + * None + * + ****************************************************************************/ + +void pci_epc_dma_free(FAR struct pci_epc_ctrl_s *epc, FAR void *mem) +{ + if (epc->dmaheap) Review Comment: done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org