-
-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update libmetal to version v2023.10.0 - 1.5.0.
Signed-off-by: iabdalkader <[email protected]>
- Loading branch information
1 parent
c2ad368
commit 3be4bc0
Showing
41 changed files
with
2,630 additions
and
2,287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (c) 2015, Xilinx Inc. and Contributors. All rights reserved. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
#include <metal/errno.h> | ||
#include <string.h> | ||
#include <metal/device.h> | ||
#include <metal/log.h> | ||
#include <metal/dma.h> | ||
#include <metal/atomic.h> | ||
|
||
int metal_dma_map(struct metal_device *dev, | ||
uint32_t dir, | ||
struct metal_sg *sg_in, | ||
int nents_in, | ||
struct metal_sg *sg_out) | ||
{ | ||
int nents_out; | ||
|
||
if (!dev || !sg_in || !sg_out) | ||
return -EINVAL; | ||
if (!dev->bus->ops.dev_dma_map) | ||
return -ENODEV; | ||
|
||
/* memory barrier */ | ||
if (dir == METAL_DMA_DEV_R) | ||
/* If it is device read, apply memory write fence. */ | ||
atomic_thread_fence(memory_order_release); | ||
else | ||
/* If it is device write or r/w, apply memory r/w fence. */ | ||
atomic_thread_fence(memory_order_acq_rel); | ||
nents_out = dev->bus->ops.dev_dma_map(dev->bus, | ||
dev, dir, sg_in, nents_in, sg_out); | ||
return nents_out; | ||
} | ||
|
||
void metal_dma_unmap(struct metal_device *dev, | ||
uint32_t dir, | ||
struct metal_sg *sg, | ||
int nents) | ||
{ | ||
/* memory barrier */ | ||
if (dir == METAL_DMA_DEV_R) | ||
/* If it is device read, apply memory write fence. */ | ||
atomic_thread_fence(memory_order_release); | ||
else | ||
/*If it is device write or r/w, apply memory r/w fence */ | ||
atomic_thread_fence(memory_order_acq_rel); | ||
|
||
if (!dev || !dev->bus->ops.dev_dma_unmap || !sg) | ||
return; | ||
dev->bus->ops.dev_dma_unmap(dev->bus, | ||
dev, dir, sg, nents); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.