drivers: dma: dma_nxp_edma: add function for channel filtering
The point of this commit is to allow users to request specific channels. The following code snippet shows how this may now be achieved: int requested_channel = 5; int ret = dma_request_channel(dev, &requested_channel); Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
This commit is contained in:
parent
4ff5e29cfe
commit
41289dac06
|
@ -573,6 +573,23 @@ static int edma_get_attribute(const struct device *dev, uint32_t type, uint32_t
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool edma_channel_filter(const struct device *dev, int chan_id, void *param)
|
||||
{
|
||||
int *requested_channel;
|
||||
|
||||
if (!param) {
|
||||
return false;
|
||||
}
|
||||
|
||||
requested_channel = param;
|
||||
|
||||
if (*requested_channel == chan_id && lookup_channel(dev, chan_id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static const struct dma_driver_api edma_api = {
|
||||
.reload = edma_reload,
|
||||
.config = edma_config,
|
||||
|
@ -582,6 +599,7 @@ static const struct dma_driver_api edma_api = {
|
|||
.resume = edma_start,
|
||||
.get_status = edma_get_status,
|
||||
.get_attribute = edma_get_attribute,
|
||||
.chan_filter = edma_channel_filter,
|
||||
};
|
||||
|
||||
static int edma_init(const struct device *dev)
|
||||
|
|
Loading…
Reference in a new issue