dma/cavs_hda: DMA driver for HDA on cAVS

Adds an initial driver for HDA streams on cAVS. A common code base is
provided for all HDA streams while the drivers are identified
differently as they have small behavior differences.

Uses dma_status to describe the positions for read/write. Uses dma_reload
to inform when to move the read/write positions. This closely follows
how HDA is being used in SoF

Simple test case is provided for both drivers.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
This commit is contained in:
Tom Burdick 2022-02-16 10:33:45 -06:00 committed by Anas Nashif
commit e018a3dff7
16 changed files with 582 additions and 2 deletions

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 2022 Intel Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_DMA_DMA_CAVS_HDA_COMMON_H_
#define ZEPHYR_DRIVERS_DMA_DMA_CAVS_HDA_COMMON_H_
#define CAVS_HDA_MAX_CHANNELS 32
#include <drivers/dma.h>
struct cavs_hda_dma_data {
struct dma_context ctx;
ATOMIC_DEFINE(channels_atomic, CAVS_HDA_MAX_CHANNELS);
};
struct cavs_hda_dma_cfg {
uint32_t base;
uint32_t dma_channels;
enum dma_channel_direction direction;
};
int cavs_hda_dma_host_in_config(const struct device *dev,
uint32_t channel,
struct dma_config *dma_cfg);
int cavs_hda_dma_host_out_config(const struct device *dev,
uint32_t channel,
struct dma_config *dma_cfg);
int cavs_hda_dma_host_reload(const struct device *dev, uint32_t channel,
uint32_t src, uint32_t dst, size_t size);
int cavs_hda_dma_status(const struct device *dev, uint32_t channel,
struct dma_status *stat);
int cavs_hda_dma_start(const struct device *dev, uint32_t channel);
int cavs_hda_dma_stop(const struct device *dev, uint32_t channel);
int cavs_hda_dma_init(const struct device *dev);
#endif /* ZEPHYR_DRIVERS_DMA_DMA_CAVS_HDA_COMMON_H_ */